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)
static void Fn(const arma::Mat< eT > &x, arma::Mat< eT > &y)
Computes the rectifier function using a dense matrix as input.
static double Deriv(const double x)
Computes the first derivative of the rectifier function.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void Deriv(const InputType &y, OutputType &x)
Computes the first derivatives of the rectifier function.
static double Fn(const double x)
Computes the rectifier function.
static void Fn(const arma::Cube< eT > &x, arma::Cube< eT > &y)
Computes the rectifier function using a 3rd-order tensor as input.
The rectifier function, defined by.