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

Implementation of the constant layer. More...

Public Member Functions

 Constant (const size_t outSize, const double scalar)
 Create the Constant object that outputs a given constant scalar value given any input value. More...
 
template<typename DataType >
void Backward (const DataType &&, DataType &&, DataType &&g)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & 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. More...
 
InputDataType & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
OutputDataType & 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 constantOutput
 Locally-stored constant output matrix. More...
 
OutputDataType delta
 Locally-stored delta object. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
size_t inSize
 Locally-stored number of input units. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 
size_t outSize
 Locally-stored number of output units. More...
 

Detailed Description

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

Implementation of the constant layer.

The constant layer outputs a given constant value given any input value.

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 34 of file constant.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
mlpack::ann::Constant< InputDataType, OutputDataType >::Constant ( const size_t  outSize,
const double  scalar 
)

Create the Constant object that outputs a given constant scalar value given any input value.

Parameters
outSizeThe number of output units.
scalarThe constant value used to create the constant output.

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename DataType >
void mlpack::ann::Constant< InputDataType, OutputDataType >::Backward ( const DataType &&  ,
DataType &&  ,
DataType &&  g 
)

Ordinary feed backward pass of a neural network.

The backward pass of the constant layer is returns always a zero output error matrix.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Constant< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.

Definition at line 80 of file constant.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Constant< InputDataType, OutputDataType >::Delta ( )
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename InputType , typename OutputType >
void mlpack::ann::Constant< InputDataType, OutputDataType >::Forward ( const InputType &&  input,
OutputType &&  output 
)

Ordinary feed forward pass of a neural network.

The forward pass fills the output with the specified constant parameter.

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

Get the input parameter.

Definition at line 70 of file constant.hpp.

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

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

Modify the input parameter.

Definition at line 72 of file constant.hpp.

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

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

Get the output parameter.

Definition at line 75 of file constant.hpp.

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

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

Modify the output parameter.

Definition at line 77 of file constant.hpp.

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

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

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::Constant< InputDataType, OutputDataType >::constantOutput
private

Locally-stored constant output matrix.

Definition at line 98 of file constant.hpp.

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

Locally-stored delta object.

Definition at line 101 of file constant.hpp.

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

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

Locally-stored input parameter object.

Definition at line 104 of file constant.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Constant< InputDataType, OutputDataType >::inSize
private

Locally-stored number of input units.

Definition at line 92 of file constant.hpp.

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

Locally-stored output parameter object.

Definition at line 107 of file constant.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Constant< InputDataType, OutputDataType >::outSize
private

Locally-stored number of output units.

Definition at line 95 of file constant.hpp.


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