diff --git a/src/mlpack/methods/ann/layer/flexible_relu_impl.hpp b/src/mlpack/methods/ann/layer/flexible_relu_impl.hpp index c2b52d61cb..25ce8faf83 100644 --- a/src/mlpack/methods/ann/layer/flexible_relu_impl.hpp +++ b/src/mlpack/methods/ann/layer/flexible_relu_impl.hpp @@ -45,9 +45,8 @@ void FlexibleReLU::Forward( { int i = -1; output = arma::zeros(input.n_rows, input.n_cols); - output.transform( [input, &i](double val) { ++i; + output.transform([input, &i](double val) { ++i; return (std::max(input(i), 0.0) + alpha); } ); - } template @@ -59,7 +58,7 @@ void FlexibleReLU::Backward( //! Compute the first derivative of FlexibleReLU function. derivative.set_size(input.n_rows, input.n_cols); int i = -1; - derivative.transform( [input, &i](double val) { ++i; + derivative.transform([input, &i](double val) { ++i; return (input(i) > 0? 1 : 0); } ); g = gy % derivative;