mlpack 3.4.2
Public Member Functions | List of all members
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...
 
double & Alpha ()
 Modify the non zero gradient. More...
 
double const & Alpha () const
 Get the non zero gradient. 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 & Delta ()
 Modify the delta. More...
 
OutputDataType const & Delta () const
 Get the delta. More...
 
bool & Deterministic ()
 Modify the value of deterministic parameter. More...
 
bool Deterministic () const
 Get the value of deterministic 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...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...
 

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).

Definition at line 60 of file celu.hpp.

Constructor & Destructor Documentation

◆ CELU()

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

◆ Alpha() [1/2]

double & Alpha ( )
inline

Modify the non zero gradient.

Definition at line 107 of file celu.hpp.

◆ Alpha() [2/2]

double const & Alpha ( ) const
inline

Get the non zero gradient.

Definition at line 105 of file celu.hpp.

◆ Backward()

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.

Using the results from the feed forward pass.

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

◆ Delta() [1/2]

OutputDataType & Delta ( )
inline

Modify the delta.

Definition at line 102 of file celu.hpp.

◆ Delta() [2/2]

OutputDataType const & Delta ( ) const
inline

Get the delta.

Definition at line 100 of file celu.hpp.

◆ Deterministic() [1/2]

bool & Deterministic ( )
inline

Modify the value of deterministic parameter.

Definition at line 112 of file celu.hpp.

◆ Deterministic() [2/2]

bool Deterministic ( ) const
inline

Get the value of deterministic parameter.

Definition at line 110 of file celu.hpp.

◆ Forward()

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.

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

◆ OutputParameter() [1/2]

OutputDataType & OutputParameter ( )
inline

Modify the output parameter.

Definition at line 97 of file celu.hpp.

◆ OutputParameter() [2/2]

OutputDataType const & OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 95 of file celu.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int   
)

Serialize the layer.


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