mlpack
Public Member Functions | List of all members
mlpack::ann::MultiplyConstant< InputDataType, OutputDataType > Class Template Reference

Implementation of the multiply constant layer. More...

#include <multiply_constant.hpp>

Public Member Functions

 MultiplyConstant (const double scalar=1.0)
 Create the MultiplyConstant object.
 
 MultiplyConstant (const MultiplyConstant &layer)
 Copy Constructor.
 
 MultiplyConstant (MultiplyConstant &&layer)
 Move Constructor.
 
MultiplyConstantoperator= (const MultiplyConstant &layer)
 Copy assignment operator.
 
MultiplyConstantoperator= (MultiplyConstant &&layer)
 Move assignment operator.
 
template<typename InputType , typename OutputType >
void Forward (const InputType &input, OutputType &output)
 Ordinary feed forward pass of a neural network. More...
 
template<typename DataType >
void Backward (const DataType &, const DataType &gy, DataType &g)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
double Scalar () const
 Get the scalar multiplier.
 
double & Scalar ()
 Modify the scalar multiplier.
 
size_t WeightSize () const
 Get the size of the weights.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

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

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename DataType >
void mlpack::ann::MultiplyConstant< InputDataType, OutputDataType >::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.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename InputType , typename OutputType >
void mlpack::ann::MultiplyConstant< InputDataType, OutputDataType >::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.

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