mlpack
master
|
Implementation of the constant layer. More...
Public Member Functions | |
Constant (const size_t outSize, const double scalar) | |
Create the Constant object that outputs a given constant scalar value given any input value. More... | |
template<typename DataType > | |
void | Backward (const DataType &&, 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... | |
InputDataType & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
OutputDataType & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
template<typename Archive > | |
void | Serialize (Archive &ar, const unsigned int) |
Serialize the layer. More... | |
Private Attributes | |
OutputDataType | constantOutput |
Locally-stored constant output matrix. More... | |
OutputDataType | delta |
Locally-stored delta object. More... | |
InputDataType | inputParameter |
Locally-stored input parameter object. More... | |
size_t | inSize |
Locally-stored number of input units. More... | |
OutputDataType | outputParameter |
Locally-stored output parameter object. More... | |
size_t | outSize |
Locally-stored number of output units. 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.
mlpack::ann::Constant< InputDataType, OutputDataType >::Constant | ( | const size_t | outSize, |
const double | scalar | ||
) |
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 && | , |
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 80 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::delta.
|
inline |
Modify the delta.
Definition at line 82 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::delta, and mlpack::ann::Constant< InputDataType, OutputDataType >::Serialize().
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. |
|
inline |
Get the input parameter.
Definition at line 70 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::inputParameter.
|
inline |
Modify the input parameter.
Definition at line 72 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::inputParameter.
|
inline |
Get the output parameter.
Definition at line 75 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::outputParameter.
|
inline |
Modify the output parameter.
Definition at line 77 of file constant.hpp.
References mlpack::ann::Constant< InputDataType, OutputDataType >::outputParameter.
void mlpack::ann::Constant< InputDataType, OutputDataType >::Serialize | ( | Archive & | ar, |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by mlpack::ann::Constant< InputDataType, OutputDataType >::Delta().
|
private |
Locally-stored constant output matrix.
Definition at line 98 of file constant.hpp.
|
private |
Locally-stored delta object.
Definition at line 101 of file constant.hpp.
Referenced by mlpack::ann::Constant< InputDataType, OutputDataType >::Delta().
|
private |
Locally-stored input parameter object.
Definition at line 104 of file constant.hpp.
Referenced by mlpack::ann::Constant< InputDataType, OutputDataType >::InputParameter().
|
private |
Locally-stored number of input units.
Definition at line 92 of file constant.hpp.
|
private |
Locally-stored output parameter object.
Definition at line 107 of file constant.hpp.
Referenced by mlpack::ann::Constant< InputDataType, OutputDataType >::OutputParameter().
|
private |
Locally-stored number of output units.
Definition at line 95 of file constant.hpp.