26 #ifndef MLPACK_METHODS_ANN_LAYER_ELU_HPP 27 #define MLPACK_METHODS_ANN_LAYER_ELU_HPP 58 typename InputDataType = arma::mat,
59 typename OutputDataType = arma::mat
80 template<
typename InputType,
typename OutputType>
81 void Forward(
const InputType&& input, OutputType&& output);
92 template<
typename DataType>
93 void Backward(
const DataType&& input, DataType&& gy, DataType&& g);
118 template<
typename Archive>
119 void Serialize(Archive& ar,
const unsigned int );
128 double fn(
const double x)
131 return (x > 0) ? x :
alpha * (std::exp(x) - 1);
141 template<
typename eT>
142 void fn(
const arma::Mat<eT>& x, arma::Mat<eT>& y)
146 for (
size_t i = 0; i < x.n_elem; i++)
160 return (y > 0) ? 1 : (y +
alpha);
170 template<
typename InputType,
typename OutputType>
171 void Deriv(
const InputType& x, OutputType& y)
175 for (
size_t i = 0; i < x.n_elem; i++)
199 #include "elu_impl.hpp" OutputDataType const & OutputParameter() const
Get the output parameter.
double Deriv(const double y)
Computes the first derivative of the ELU function.
double & Alpha()
Modify the non zero gradient.
Linear algebra utility functions, generally performed on matrices or vectors.
OutputDataType const & Delta() const
Get the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Deriv(const InputType &x, OutputType &y)
Computes the first derivative of the ELU function.
void fn(const arma::Mat< eT > &x, arma::Mat< eT > &y)
Computes the ELU function using a dense matrix as input.
double alpha
ELU Hyperparameter (0 < alpha)
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
InputDataType const & InputParameter() const
Get the input parameter.
void Serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Forward(const InputType &&input, OutputType &&output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
OutputDataType & Delta()
Modify the delta.
OutputDataType outputParameter
Locally-stored output parameter object.
double const & Alpha() const
Get the non zero gradient.
InputDataType inputParameter
Locally-stored input parameter object.
void Backward(const DataType &&input, DataType &&gy, DataType &&g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
OutputDataType delta
Locally-stored delta object.
The ELU activation function, defined by.
ELU(const double alpha=1.0)
Create the ELU object using the specified parameters.
double fn(const double x)
Computes the ELU function.