24 #ifndef MLPACK_METHODS_ANN_LAYER_ELU_HPP 25 #define MLPACK_METHODS_ANN_LAYER_ELU_HPP 102 typename InputDataType = arma::mat,
103 typename OutputDataType = arma::mat
123 ELU(
const double alpha);
132 template<
typename InputType,
typename OutputType>
133 void Forward(
const InputType&& input, OutputType&& output);
144 template<
typename DataType>
145 void Backward(
const DataType&& input, DataType&& gy, DataType&& g);
158 OutputDataType
const&
Delta()
const {
return delta; }
160 OutputDataType&
Delta() {
return delta; }
163 double const&
Alpha()
const {
return alpha; }
168 double const&
Lambda()
const {
return lambda; }
173 template<
typename Archive>
174 void serialize(Archive& ar,
const unsigned int );
183 double Fn(
const double x)
187 return (x > 0) ? lambda * x : lambda * alpha * (std::exp(x) - 1);
199 template<
typename eT>
200 void Fn(
const arma::Mat<eT>& x, arma::Mat<eT>& y)
204 for (
size_t i = 0; i < x.n_elem; i++)
216 double Deriv(
const double y)
218 return (y > 0) ? lambda : lambda * (y + alpha);
227 template<
typename InputType,
typename OutputType>
228 void Deriv(
const InputType& x, OutputType& y)
232 for (
size_t i = 0; i < x.n_elem; i++)
239 OutputDataType delta;
242 InputDataType inputParameter;
245 OutputDataType outputParameter;
265 #include "elu_impl.hpp" double const & Alpha() const
Get the non zero gradient.
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()
Modify the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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...
InputDataType & InputParameter()
Modify the input parameter.
InputDataType const & InputParameter() const
Get the input parameter.
OutputDataType const & OutputParameter() const
Get the output parameter.
ELU()
Create the ELU object.
double & Alpha()
Modify the non zero gradient.
The ELU activation function, defined by.
OutputDataType & OutputParameter()
Modify the output parameter.
double const & Lambda() const
Get the lambda parameter.
OutputDataType const & Delta() const
Get the delta.