MultiplyConstant< InputDataType, OutputDataType > Class Template Reference

Implementation of the multiply constant layer. More...

Public Member Functions

 MultiplyConstant (const double scalar=1.0)
 Create the MultiplyConstant object. More...

 
 MultiplyConstant (const MultiplyConstant &layer)
 Copy Constructor. More...

 
 MultiplyConstant (MultiplyConstant &&layer)
 Move Constructor. More...

 
template
<
typename
DataType
>
void Backward (const DataType &, const DataType &gy, 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...

 
MultiplyConstantoperator= (const MultiplyConstant &layer)
 Copy assignment operator. More...

 
MultiplyConstantoperator= (MultiplyConstant &&layer)
 Move assignment operator. More...

 
OutputDataType & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
double Scalar () const
 Get the scalar multiplier. More...

 
double & Scalar ()
 Modify the scalar multiplier. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
size_t WeightSize () const
 Get the size of the weights. More...

 

Detailed Description


template
<
typename
InputDataType
=
arma::mat
,
typename
OutputDataType
=
arma::mat
>

class mlpack::ann::MultiplyConstant< InputDataType, OutputDataType >

Implementation of the multiply constant layer.

The multiply constant layer multiplies the input by a (non-learnable) constant.

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

Constructor & Destructor Documentation

◆ MultiplyConstant() [1/3]

MultiplyConstant ( const double  scalar = 1.0)

Create the MultiplyConstant object.

◆ MultiplyConstant() [2/3]

MultiplyConstant ( const MultiplyConstant< InputDataType, OutputDataType > &  layer)

Copy Constructor.

◆ MultiplyConstant() [3/3]

MultiplyConstant ( MultiplyConstant< InputDataType, OutputDataType > &&  layer)

Move Constructor.

Member Function Documentation

◆ Backward()

void Backward ( const DataType &  ,
const DataType &  gy,
DataType &  g 
)

Ordinary feed backward pass of a neural network.

The backward pass multiplies the error with the specified constant scalar value.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Delta() [1/2]

OutputDataType& Delta ( ) const
inline

Get the delta.

Definition at line 81 of file multiply_constant.hpp.

◆ Delta() [2/2]

OutputDataType& Delta ( )
inline

Modify the delta.

Definition at line 83 of file multiply_constant.hpp.

◆ Forward()

void Forward ( const InputType &  input,
OutputType &  output 
)

Ordinary feed forward pass of a neural network.

Multiply the input with the specified constant scalar value.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

◆ operator=() [1/2]

MultiplyConstant& operator= ( const MultiplyConstant< InputDataType, OutputDataType > &  layer)

Copy assignment operator.

◆ operator=() [2/2]

MultiplyConstant& operator= ( MultiplyConstant< InputDataType, OutputDataType > &&  layer)

Move assignment operator.

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 76 of file multiply_constant.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 78 of file multiply_constant.hpp.

◆ Scalar() [1/2]

double Scalar ( ) const
inline

Get the scalar multiplier.

Definition at line 86 of file multiply_constant.hpp.

◆ Scalar() [2/2]

double& Scalar ( )
inline

Modify the scalar multiplier.

Definition at line 88 of file multiply_constant.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

◆ WeightSize()

size_t WeightSize ( ) const
inline

Get the size of the weights.

Definition at line 91 of file multiply_constant.hpp.

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


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