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... | |
MultiplyConstant & | operator= (const MultiplyConstant &layer) |
Copy assignment operator. More... | |
MultiplyConstant & | operator= (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... | |
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). |
Definition at line 34 of file multiply_constant.hpp.
MultiplyConstant | ( | const double | scalar = 1.0 | ) |
Create the MultiplyConstant object.
MultiplyConstant | ( | const MultiplyConstant< InputDataType, OutputDataType > & | layer | ) |
Copy Constructor.
MultiplyConstant | ( | MultiplyConstant< InputDataType, OutputDataType > && | layer | ) |
Move Constructor.
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.
* | (input) The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 81 of file multiply_constant.hpp.
|
inline |
Modify the delta.
Definition at line 83 of file multiply_constant.hpp.
void 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. |
MultiplyConstant& operator= | ( | const MultiplyConstant< InputDataType, OutputDataType > & | layer | ) |
Copy assignment operator.
MultiplyConstant& operator= | ( | MultiplyConstant< InputDataType, OutputDataType > && | layer | ) |
Move assignment operator.
|
inline |
Get the output parameter.
Definition at line 76 of file multiply_constant.hpp.
|
inline |
Modify the output parameter.
Definition at line 78 of file multiply_constant.hpp.
|
inline |
Get the scalar multiplier.
Definition at line 86 of file multiply_constant.hpp.
|
inline |
Modify the scalar multiplier.
Definition at line 88 of file multiply_constant.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by MultiplyConstant< InputDataType, OutputDataType >::WeightSize().
|
inline |
Get the size of the weights.
Definition at line 91 of file multiply_constant.hpp.
References MultiplyConstant< InputDataType, OutputDataType >::serialize().