Implementation of the reinforce normal layer. More...
Public Member Functions | |
ReinforceNormalType (const double stdev=1.0) | |
Create the ReinforceNormal object. More... | |
void | Backward (const InputType &input, const OutputType &, OutputType &g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More... | |
ReinforceNormalType * | Clone () const |
Clone the ReinforceNormalType object. This handles polymorphism correctly. More... | |
void | Forward (const InputType &input, OutputType &output) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
double const & | Reward () const |
Get the value of the reward parameter. More... | |
double & | Reward () |
Modify the value of the deterministic parameter. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
double const & | StandardDeviation () const |
Get the standard deviation used during forward and backward pass. More... | |
![]() | |
Layer () | |
Default constructor. More... | |
Layer (const Layer &layer) | |
Copy constructor. This is not responsible for copying weights! More... | |
Layer (Layer &&layer) | |
Move constructor. This is not responsible for moving weights! More... | |
virtual | ~Layer () |
Default deconstructor. More... | |
virtual void | Backward (const InputType &, const InputType &, InputType &) |
Performs a backpropagation step through the layer, with respect to the given input. More... | |
virtual void | ComputeOutputDimensions () |
Compute the output dimensions. More... | |
virtual void | CustomInitialize (InputType &, const size_t) |
Override the weight matrix of the layer. More... | |
virtual void | Forward (const InputType &, InputType &) |
Takes an input object, and computes the corresponding output of the layer. More... | |
virtual void | Forward (const InputType &, const InputType &) |
Takes an input and output object, and computes the corresponding loss of the layer. More... | |
virtual void | Gradient (const InputType &, const InputType &, InputType &) |
Computing the gradient of the layer with respect to its own input. More... | |
const std::vector< size_t > & | InputDimensions () const |
Get the input dimensions. More... | |
std::vector< size_t > & | InputDimensions () |
Modify the input dimensions. More... | |
virtual double | Loss () |
Get the layer loss. More... | |
virtual Layer & | operator= (const Layer &layer) |
Copy assignment operator. This is not responsible for copying weights! More... | |
virtual Layer & | operator= (Layer &&layer) |
Move assignment operator. This is not responsible for moving weights! More... | |
const std::vector< size_t > & | OutputDimensions () |
Get the output dimensions. More... | |
virtual size_t | OutputSize () final |
Get the number of elements in the output from this layer. More... | |
virtual const InputType & | Parameters () const |
Get the parameters. More... | |
virtual InputType & | Parameters () |
Set the parameters. More... | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
virtual void | SetWeights (typename InputType ::elem_type *) |
Reset the layer parameter. More... | |
virtual bool const & | Training () const |
Get whether the layer is currently in training mode. More... | |
virtual bool & | Training () |
Modify whether the layer is currently in training mode. More... | |
virtual size_t | WeightSize () const |
Get the total number of trainable weights in the layer. More... | |
Additional Inherited Members | |
![]() | |
std::vector< size_t > | inputDimensions |
Logical input dimensions of each point. More... | |
std::vector< size_t > | outputDimensions |
Logical output dimensions of each point. More... | |
bool | training |
If true, the layer is in training mode; otherwise, it is in testing mode. More... | |
bool | validOutputDimensions |
This is true if ComputeOutputDimensions() has been called, and outputDimensions can be considered to be up-to-date. More... | |
Implementation of the reinforce normal layer.
The reinforce normal layer implements the REINFORCE algorithm for the normal distribution.
InputType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 35 of file reinforce_normal.hpp.
ReinforceNormalType | ( | const double | stdev = 1.0 | ) |
Create the ReinforceNormal object.
stdev | Standard deviation used during the forward and backward pass. |
Referenced by ReinforceNormalType< InputType, OutputType >::Clone().
void Backward | ( | const InputType & | input, |
const OutputType & | , | ||
OutputType & | g | ||
) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f.
Using the results from the feed forward pass.
input | The propagated input activation. |
* | (gy) The backpropagated error. |
g | The calculated gradient. |
Referenced by ReinforceNormalType< InputType, OutputType >::Clone().
|
inlinevirtual |
Clone the ReinforceNormalType object. This handles polymorphism correctly.
Implements Layer< InputType, OutputType >.
Definition at line 46 of file reinforce_normal.hpp.
References ReinforceNormalType< InputType, OutputType >::Backward(), ReinforceNormalType< InputType, OutputType >::Forward(), and ReinforceNormalType< InputType, OutputType >::ReinforceNormalType().
void Forward | ( | const InputType & | input, |
OutputType & | 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. |
Referenced by ReinforceNormalType< InputType, OutputType >::Clone().
|
inline |
Get the value of the reward parameter.
Definition at line 71 of file reinforce_normal.hpp.
|
inline |
Modify the value of the deterministic parameter.
Definition at line 73 of file reinforce_normal.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by ReinforceNormalType< InputType, OutputType >::StandardDeviation().
|
inline |
Get the standard deviation used during forward and backward pass.
Definition at line 76 of file reinforce_normal.hpp.
References ReinforceNormalType< InputType, OutputType >::serialize().