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