Constant< InputDataType, OutputDataType > Class Template Reference

Implementation of the constant layer. More...

Public Member Functions

 Constant (const size_t outSize=0, const double scalar=0.0)
 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...

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

 

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

◆ Constant()

Constant ( const size_t  outSize = 0,
const double  scalar = 0.0 
)

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

◆ Backward()

void 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.

◆ Delta() [1/2]

OutputDataType& Delta ( ) const
inline

Get the delta.

Definition at line 75 of file constant.hpp.

◆ Delta() [2/2]

OutputDataType& Delta ( )
inline

Modify the delta.

Definition at line 77 of file constant.hpp.

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

◆ Forward()

void 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.

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 70 of file constant.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 72 of file constant.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the layer.

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


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/methods/ann/layer/constant.hpp