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
71 ELU(
const double alpha = 1.0);
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);
106 OutputDataType
const&
Delta()
const {
return delta; }
108 OutputDataType&
Delta() {
return delta; }
111 double const&
Alpha()
const {
return alpha; }
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++)
158 double Deriv(
const double y)
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++)
182 OutputDataType delta;
185 InputDataType inputParameter;
188 OutputDataType outputParameter;
198 #include "elu_impl.hpp" ELU(const double alpha=1.0)
Create the ELU object using the specified parameters.
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.
double & Alpha()
Modify the non zero gradient.
The ELU activation function, defined by.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType const & Delta() const
Get the delta.