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 = arma::max(arma::zeros<arma::Mat<eT> >(x.n_rows, x.n_cols), x);
78 static void fn(
const arma::Cube<eT>& x, arma::Cube<eT>& y)
81 for (
size_t s = 0; s < x.n_slices; s++)
82 fn(x.slice(s), y.slice(s));
91 static double deriv(
const double y)
102 template<
typename InputType,
typename OutputType>
103 static void deriv(
const InputType& y, OutputType& x)
107 for (
size_t i = 0; i < y.n_elem; i++)
static void deriv(const InputType &y, OutputType &x)
Computes the first derivatives of the rectifier function.
static double deriv(const double y)
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 fn(const arma::Cube< eT > &x, arma::Cube< eT > &y)
Computes the rectifier function using a 3rd-order tensor as input.
static void fn(const arma::Mat< eT > &x, arma::Mat< eT > &y)
Computes the rectifier function using a dense matrix as input.
static double fn(const double x)
Computes the rectifier function.
The rectifier function, defined by.