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 &, const 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... | |
size_t | OutSize () const |
Get the output size. 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 constant layer.
The constant layer outputs a given constant value given any input value.
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 constant.hpp.
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.
outSize | The number of output units. |
scalar | The constant value used to create the constant output. |
void Backward | ( | const DataType & | , |
const 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.
* | (input) The propagated input activation. |
* | (gy) The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 75 of file constant.hpp.
|
inline |
Modify the delta.
Definition at line 77 of file constant.hpp.
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.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
|
inline |
Get the output parameter.
Definition at line 70 of file constant.hpp.
|
inline |
Modify the output parameter.
Definition at line 72 of file constant.hpp.
|
inline |
Get the output size.
Definition at line 80 of file constant.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by Constant< InputDataType, OutputDataType >::WeightSize().
|
inline |
Get the size of the weights.
Definition at line 83 of file constant.hpp.
References Constant< InputDataType, OutputDataType >::serialize().