mlpack
|
The Flatten T Swish activation function, defined by. More...
#include <flatten_t_swish.hpp>
Public Member Functions | |
FlattenTSwish (const double T=-0.20) | |
Create the Flatten T Swish object using the specified parameters. 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 & | T () const |
Get the T parameter. | |
double & | T () |
Modify the T parameter. | |
size_t | WeightSize () const |
Get size of weights. | |
template<typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. | |
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*}
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
mlpack::ann::FlattenTSwish< InputDataType, OutputDataType >::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.
T |
void mlpack::ann::FlattenTSwish< 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.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
void mlpack::ann::FlattenTSwish< 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.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |