23 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_RECTIFIER_FUNCTION_HPP
24 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_RECTIFIER_FUNCTION_HPP
54 static double Fn(
const double x)
56 return std::max(0.0, x);
66 static void Fn(
const arma::Mat<eT>& x, arma::Mat<eT>& y)
68 y.zeros(x.n_rows, x.n_cols);
79 static void Fn(
const arma::Cube<eT>& x, arma::Cube<eT>& y)
81 y.zeros(x.n_rows, x.n_cols, x.n_slices);
91 static double Deriv(
const double x)
93 return (
double)(x > 0);
102 template<
typename InputType,
typename OutputType>
103 static void Deriv(
const InputType& y, OutputType& x)
105 x.set_size(arma::size(y));
107 for (
size_t i = 0; i < y.n_elem; ++i)