FlattenTSwish< InputDataType, OutputDataType > Class Template Reference

The Flatten T Swish activation function, defined by. More...

Public Member Functions

 FlattenTSwish (const double T=-0.20)
 Create the Flatten T Swish object using the specified parameters. 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 & Delta () const
 Get the delta. More...

 
OutputDataType & Delta ()
 Modify the delta. 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 const & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
double const & T () const
 Get the T parameter. More...

 
double & T ()
 Modify the T parameter. More...

 
size_t WeightSize () const
 Get size of weights. More...

 

Detailed Description


template
<
typename
InputDataType
=
arma::mat
,
typename
OutputDataType
=
arma::mat
>

class mlpack::ann::FlattenTSwish< InputDataType, OutputDataType >

The Flatten T Swish activation function, defined by.

\begin{eqnarray*} f'(x) &=& \left\{ \begin{array}{lr} frac{x}{1+exp(-x)} + T & : x \ge 0 \\ T & : x < 0 \end{array} \right. \\ f'(x) &=& \left\{ \begin{array}{lr} \sigma(x)(1 - f(x)) + f(x) & : x > 0 \\ 0 & : x \le 0 \end{array} \right. \end{eqnarray*}

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 49 of file flatten_t_swish.hpp.

Constructor & Destructor Documentation

◆ FlattenTSwish()

FlattenTSwish ( const double  T = -0.20)

Create the Flatten T Swish object using the specified parameters.

The thresholded value T can be adjusted via T paramaters. When the x is < 0, T will be used instead of 0. The default value of T is -0.20 as suggested in the paper.

Parameters
T

Member Function Documentation

◆ 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.
gyThe backpropagated error.
gThe calculated gradient.

◆ Delta() [1/2]

OutputDataType const& Delta ( ) const
inline

Get the delta.

Definition at line 89 of file flatten_t_swish.hpp.

◆ Delta() [2/2]

OutputDataType& Delta ( )
inline

Modify the delta.

Definition at line 91 of file flatten_t_swish.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 const& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 84 of file flatten_t_swish.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 86 of file flatten_t_swish.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

◆ T() [1/2]

double const& T ( ) const
inline

Get the T parameter.

Definition at line 94 of file flatten_t_swish.hpp.

◆ T() [2/2]

double& T ( )
inline

Modify the T parameter.

Definition at line 96 of file flatten_t_swish.hpp.

◆ WeightSize()

size_t WeightSize ( ) const
inline

Get size of weights.

Definition at line 99 of file flatten_t_swish.hpp.

References FlattenTSwish< InputDataType, OutputDataType >::serialize().


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