|
mlpack
|
The Hard Tanh activation function, defined by. More...
#include <hard_tanh.hpp>
Public Member Functions | |
| HardTanH (const double maxValue=1, const double minValue=-1) | |
| Create the HardTanH 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 & | MaxValue () const |
| Get the maximum value. | |
| double & | MaxValue () |
| Modify the maximum value. | |
| double const & | MinValue () const |
| Get the minimum value. | |
| double & | MinValue () |
| Modify the minimum value. | |
| template<typename Archive > | |
| void | serialize (Archive &ar, const uint32_t) |
| Serialize the layer. | |
The Hard Tanh activation function, defined by.
\begin{eqnarray*} f(x) &=& \left\{ \begin{array}{lr} max & : x > maxValue \\ min & : x \le minValue \\ x & : otherwise \end{array} \right. \\ f'(x) &=& \left\{ \begin{array}{lr} 0 & : x > maxValue \\ 0 & : x \le minValue \\ 1 & : otherwise \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::HardTanH< InputDataType, OutputDataType >::HardTanH | ( | const double | maxValue = 1, |
| const double | minValue = -1 |
||
| ) |
Create the HardTanH object using the specified parameters.
The range of the linear region can be adjusted by specifying the maxValue and minValue. Default (maxValue = 1, minValue = -1).
| maxValue | Range of the linear region maximum value. |
| minValue | Range of the linear region minimum value. |
| void mlpack::ann::HardTanH< 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::HardTanH< 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. |
1.8.13