mlpack
|
Implementation of the constant layer. More...
#include <constant.hpp>
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 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 &, 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. | |
size_t | OutSize () const |
Get the output size. | |
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 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). |
mlpack::ann::Constant< InputDataType, OutputDataType >::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 mlpack::ann::Constant< InputDataType, OutputDataType >::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. |
void mlpack::ann::Constant< InputDataType, OutputDataType >::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. |