mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::ann::HardTanH< InputDataType, OutputDataType > Class Template Reference

The Hard Tanh activation function, defined by. More...

Public Member Functions

 HardTanH (const double maxValue=1, const double minValue=-1)
 Create the HardTanH object using the specified parameters. More...
 
template<typename DataType >
void Backward (const DataType &&input, 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...
 
InputDataType const & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
double const & MaxValue () const
 Get the maximum value. More...
 
double & MaxValue ()
 Modify the maximum value. More...
 
double const & MinValue () const
 Get the minimum value. More...
 
double & MinValue ()
 Modify the minimum value. 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 unsigned int)
 Serialize the layer. More...
 

Private Attributes

OutputDataType delta
 Locally-stored delta object. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
double maxValue
 Maximum value for the HardTanH function. More...
 
double minValue
 Minimum value for the HardTanH function. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 

Detailed Description

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

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*}

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 hard_tanh.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
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).

Parameters
maxValueRange of the linear region maximum value.
minValueRange of the linear region minimum value.

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename DataType >
void mlpack::ann::HardTanH< InputDataType, OutputDataType >::Backward ( const DataType &&  input,
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.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::HardTanH< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.

Definition at line 97 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::HardTanH< InputDataType, OutputDataType >::Delta ( )
inline

Modify the delta.

Definition at line 99 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename InputType , typename OutputType >
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.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType const& mlpack::ann::HardTanH< InputDataType, OutputDataType >::InputParameter ( ) const
inline

Get the input parameter.

Definition at line 87 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::HardTanH< InputDataType, OutputDataType >::InputParameter ( )
inline

Modify the input parameter.

Definition at line 89 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double const& mlpack::ann::HardTanH< InputDataType, OutputDataType >::MaxValue ( ) const
inline

Get the maximum value.

Definition at line 102 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::maxValue.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double& mlpack::ann::HardTanH< InputDataType, OutputDataType >::MaxValue ( )
inline

Modify the maximum value.

Definition at line 104 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::maxValue.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double const& mlpack::ann::HardTanH< InputDataType, OutputDataType >::MinValue ( ) const
inline

Get the minimum value.

Definition at line 107 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::minValue.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double& mlpack::ann::HardTanH< InputDataType, OutputDataType >::MinValue ( )
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::HardTanH< InputDataType, OutputDataType >::OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 92 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::HardTanH< InputDataType, OutputDataType >::OutputParameter ( )
inline

Modify the output parameter.

Definition at line 94 of file hard_tanh.hpp.

References mlpack::ann::HardTanH< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename Archive >
void mlpack::ann::HardTanH< InputDataType, OutputDataType >::Serialize ( Archive &  ar,
const unsigned  int 
)

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::HardTanH< InputDataType, OutputDataType >::delta
private

Locally-stored delta object.

Definition at line 119 of file hard_tanh.hpp.

Referenced by mlpack::ann::HardTanH< InputDataType, OutputDataType >::Delta().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType mlpack::ann::HardTanH< InputDataType, OutputDataType >::inputParameter
private

Locally-stored input parameter object.

Definition at line 122 of file hard_tanh.hpp.

Referenced by mlpack::ann::HardTanH< InputDataType, OutputDataType >::InputParameter().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::HardTanH< InputDataType, OutputDataType >::maxValue
private

Maximum value for the HardTanH function.

Definition at line 128 of file hard_tanh.hpp.

Referenced by mlpack::ann::HardTanH< InputDataType, OutputDataType >::MaxValue().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::HardTanH< InputDataType, OutputDataType >::minValue
private

Minimum value for the HardTanH function.

Definition at line 131 of file hard_tanh.hpp.

Referenced by mlpack::ann::HardTanH< InputDataType, OutputDataType >::MinValue().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::HardTanH< InputDataType, OutputDataType >::outputParameter
private

Locally-stored output parameter object.

Definition at line 125 of file hard_tanh.hpp.

Referenced by mlpack::ann::HardTanH< InputDataType, OutputDataType >::OutputParameter().


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