mlpack
|
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. | |
MultiplyConstant & | operator= (const MultiplyConstant &layer) |
Copy assignment operator. | |
MultiplyConstant & | operator= (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. | |
Implementation of the multiply constant layer.
The multiply constant layer multiplies the input by a (non-learnable) constant.
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
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.
* | (input) The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
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.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |