mlpack
Public Member Functions | List of all members
mlpack::ann::CELU< InputDataType, OutputDataType > Class Template Reference

The CELU activation function, defined by. More...

#include <celu.hpp>

Public Member Functions

 CELU (const double alpha=1.0)
 Create the CELU object using the specified parameter. More...
 
template<typename InputType , typename OutputType >
void Forward (const InputType &input, OutputType &output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
template<typename DataType >
void Backward (const DataType &input, const DataType &gy, DataType &g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
double const & Alpha () const
 Get the non zero gradient.
 
double & Alpha ()
 Modify the non zero gradient.
 
bool Deterministic () const
 Get the value of deterministic parameter.
 
bool & Deterministic ()
 Modify the value of deterministic parameter.
 
size_t WeightSize ()
 Get size of weights.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::CELU< InputDataType, OutputDataType >

The CELU activation function, defined by.

\begin{eqnarray*} f(x) &=& \left\{ \begin{array}{lr} x & : x \ge 0 \\ \alpha(e^(\frac{x}{\alpha}) - 1) & : x < 0 \end{array} \right. \\ f'(x) &=& \left\{ \begin{array}{lr} 1 & : x \ge 0 \\ (\frac{f(x)}{\alpha}) + 1 & : x < 0 \end{array} \right. \end{eqnarray*}

In the deterministic mode, there is no computation of the derivative.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ CELU()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::CELU< InputDataType, OutputDataType >::CELU ( const double  alpha = 1.0)

Create the CELU object using the specified parameter.

The non zero gradient for negative inputs can be adjusted by specifying the CELU hyperparameter alpha (alpha > 0).

Parameters
alphaScale parameter for the negative factor (default = 1.0).

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename DataType >
void mlpack::ann::CELU< InputDataType, OutputDataType >::Backward ( const DataType &  input,
const DataType &  gy,
DataType &  g 
)

Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f.

Using the results from the feed forward pass.

Parameters
inputThe propagated input activation f(x).
gyThe backpropagated error.
gThe calculated gradient.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename InputType , typename OutputType >
void mlpack::ann::CELU< InputDataType, OutputDataType >::Forward ( const InputType &  input,
OutputType &  output 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

The documentation for this class was generated from the following files: