mlpack
master
|
Implementation of the RecurrentLayer class. More...
Public Member Functions | |
template<typename StartModuleType , typename InputModuleType , typename FeedbackModuleType , typename TransferModuleType > | |
Recurrent (const StartModuleType &start, const InputModuleType &input, const FeedbackModuleType &feedback, const TransferModuleType &transfer, const size_t rho) | |
Create the Recurrent object using the specified modules. More... | |
template<typename eT > | |
void | Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More... | |
OutputDataType const & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
bool | Deterministic () const |
The value of the deterministic parameter. More... | |
bool & | Deterministic () |
Modify the value of the deterministic parameter. More... | |
template<typename eT > | |
void | Forward (arma::Mat< eT > &&input, arma::Mat< eT > &&output) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
template<typename eT > | |
void | Gradient (arma::Mat< eT > &&input, arma::Mat< eT > &&error, arma::Mat< eT > &&) |
OutputDataType const & | Gradient () const |
Get the gradient. More... | |
OutputDataType & | Gradient () |
Modify the gradient. More... | |
InputDataType const & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
std::vector< LayerTypes > & | Model () |
Get the model modules. More... | |
OutputDataType const & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
OutputDataType const & | Parameters () const |
Get the parameters. More... | |
OutputDataType & | Parameters () |
Modify the parameters. More... | |
template<typename Archive > | |
void | Serialize (Archive &ar, const unsigned int) |
Serialize the layer. More... | |
Private Attributes | |
size_t | backwardStep |
Locally-stored number of backward steps. More... | |
OutputDataType | delta |
Locally-stored delta object. More... | |
DeltaVisitor | deltaVisitor |
Locally-stored delta visitor. More... | |
bool | deterministic |
If true dropout and scaling is disabled, see notes above. More... | |
LayerTypes | feedbackModule |
Locally-stored feedback module. More... | |
std::vector< arma::mat > | feedbackOutputParameter |
Locally-stored feedback output parameters. More... | |
size_t | forwardStep |
Locally-stored number of forward steps. More... | |
OutputDataType | gradient |
Locally-stored gradient object. More... | |
size_t | gradientStep |
Locally-stored number of gradient steps. More... | |
LayerTypes | initialModule |
Locally-stored initial module. More... | |
LayerTypes | inputModule |
Locally-stored input module. More... | |
InputDataType | inputParameter |
Locally-stored input parameter object. More... | |
LayerTypes | mergeModule |
Locally-stored merge module. More... | |
std::vector< LayerTypes > | network |
Locally-stored model modules. More... | |
OutputDataType | outputParameter |
Locally-stored output parameter object. More... | |
OutputParameterVisitor | outputParameterVisitor |
Locally-stored output parameter visitor. More... | |
OutputDataType | parameters |
Locally-stored weight object. More... | |
arma::mat | recurrentError |
Locally-stored recurrent error parameter. More... | |
LayerTypes | recurrentModule |
Locally-stored recurrent module. More... | |
size_t | rho |
Number of steps to backpropagate through time (BPTT). More... | |
LayerTypes | startModule |
Locally-stored start module. More... | |
LayerTypes | transferModule |
Locally-stored transfer module. More... | |
WeightSizeVisitor | weightSizeVisitor |
Locally-stored weight size visitor. More... | |
Implementation of the RecurrentLayer class.
Recurrent layers can be used similarly to feed-forward layers.
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 52 of file layer_types.hpp.
mlpack::ann::Recurrent< InputDataType, OutputDataType >::Recurrent | ( | const StartModuleType & | start, |
const InputModuleType & | input, | ||
const FeedbackModuleType & | feedback, | ||
const TransferModuleType & | transfer, | ||
const size_t | rho | ||
) |
Create the Recurrent object using the specified modules.
start | The start module. |
start | The input module. |
start | The feedback module. |
start | The transfer module. |
rho | Maximum number of steps to backpropagate through time (BPTT). |
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Backward | ( | const arma::Mat< eT > && | , |
arma::Mat< eT > && | gy, | ||
arma::Mat< eT > && | g | ||
) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f.
Using the results from the feed forward pass.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 125 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::delta.
|
inline |
Modify the delta.
Definition at line 127 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::delta.
|
inline |
The value of the deterministic parameter.
Definition at line 105 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::deterministic.
|
inline |
Modify the value of the deterministic parameter.
Definition at line 107 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::deterministic.
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Forward | ( | arma::Mat< eT > && | input, |
arma::Mat< eT > && | output | ||
) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient | ( | arma::Mat< eT > && | input, |
arma::Mat< eT > && | error, | ||
arma::Mat< eT > && | |||
) |
|
inline |
Get the gradient.
Definition at line 130 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::gradient.
|
inline |
Modify the gradient.
Definition at line 132 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::gradient, and mlpack::ann::Recurrent< InputDataType, OutputDataType >::Serialize().
|
inline |
Get the input parameter.
Definition at line 115 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::inputParameter.
|
inline |
Modify the input parameter.
Definition at line 117 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::inputParameter.
|
inline |
Get the model modules.
Definition at line 102 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::network.
|
inline |
Get the output parameter.
Definition at line 120 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::outputParameter.
|
inline |
Modify the output parameter.
Definition at line 122 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::outputParameter.
|
inline |
Get the parameters.
Definition at line 110 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::parameters.
|
inline |
Modify the parameters.
Definition at line 112 of file recurrent.hpp.
References mlpack::ann::Recurrent< InputDataType, OutputDataType >::parameters.
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Serialize | ( | Archive & | ar, |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient().
|
private |
Locally-stored number of backward steps.
Definition at line 160 of file recurrent.hpp.
|
private |
Locally-stored delta object.
Definition at line 196 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Delta().
|
private |
Locally-stored delta visitor.
Definition at line 187 of file recurrent.hpp.
|
private |
If true dropout and scaling is disabled, see notes above.
Definition at line 166 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Deterministic().
|
private |
Locally-stored feedback module.
Definition at line 148 of file recurrent.hpp.
|
private |
Locally-stored feedback output parameters.
Definition at line 193 of file recurrent.hpp.
|
private |
Locally-stored number of forward steps.
Definition at line 157 of file recurrent.hpp.
|
private |
Locally-stored gradient object.
Definition at line 199 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient().
|
private |
Locally-stored number of gradient steps.
Definition at line 163 of file recurrent.hpp.
|
private |
Locally-stored initial module.
Definition at line 172 of file recurrent.hpp.
|
private |
Locally-stored input module.
Definition at line 145 of file recurrent.hpp.
|
private |
Locally-stored input parameter object.
Definition at line 202 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::InputParameter().
|
private |
Locally-stored merge module.
Definition at line 181 of file recurrent.hpp.
|
private |
Locally-stored model modules.
Definition at line 178 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Model().
|
private |
Locally-stored output parameter object.
Definition at line 205 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::OutputParameter().
|
private |
Locally-stored output parameter visitor.
Definition at line 190 of file recurrent.hpp.
|
private |
Locally-stored weight object.
Definition at line 169 of file recurrent.hpp.
Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Parameters().
|
private |
Locally-stored recurrent error parameter.
Definition at line 208 of file recurrent.hpp.
|
private |
Locally-stored recurrent module.
Definition at line 175 of file recurrent.hpp.
|
private |
Number of steps to backpropagate through time (BPTT).
Definition at line 154 of file recurrent.hpp.
|
private |
Locally-stored start module.
Definition at line 142 of file recurrent.hpp.
|
private |
Locally-stored transfer module.
Definition at line 151 of file recurrent.hpp.
|
private |
Locally-stored weight size visitor.
Definition at line 184 of file recurrent.hpp.