reinforce_normal.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_REINFORCE_NORMAL_HPP
14 #define MLPACK_METHODS_ANN_LAYER_REINFORCE_NORMAL_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace ann {
20 
30 template <
31  typename InputDataType = arma::mat,
32  typename OutputDataType = arma::mat
33 >
35 {
36  public:
42  ReinforceNormal(const double stdev = 1.0);
43 
51  template<typename eT>
52  void Forward(const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
53 
63  template<typename DataType>
64  void Backward(const DataType&& input, DataType&& /* gy */, DataType&& g);
65 
67  InputDataType& InputParameter() const { return inputParameter; }
69  InputDataType& InputParameter() { return inputParameter; }
70 
72  OutputDataType& OutputParameter() const { return outputParameter; }
74  OutputDataType& OutputParameter() { return outputParameter; }
75 
77  OutputDataType& Delta() const { return delta; }
79  OutputDataType& Delta() { return delta; }
80 
82  bool Deterministic() const { return deterministic; }
84  bool& Deterministic() { return deterministic; }
85 
87  double Reward() const { return reward; }
89  double& Reward() { return reward; }
90 
94  template<typename Archive>
95  void serialize(Archive& /* ar */, const unsigned int /* version */);
96 
97  private:
99  double stdev;
100 
102  double reward;
103 
105  OutputDataType delta;
106 
108  InputDataType inputParameter;
109 
111  OutputDataType outputParameter;
112 
114  std::vector<arma::mat> moduleInputParameter;
115 
117  bool deterministic;
118 }; // class ReinforceNormal
119 
120 } // namespace ann
121 } // namespace mlpack
122 
123 // Include implementation.
124 #include "reinforce_normal_impl.hpp"
125 
126 #endif
ReinforceNormal(const double stdev=1.0)
Create the ReinforceNormal object.
OutputDataType & Delta() const
Get the delta.
InputDataType & InputParameter()
Modify the input parameter.
.hpp
Definition: add_to_po.hpp:21
Implementation of the reinforce normal layer.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
void Backward(const DataType &&input, DataType &&, DataType &&g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta()
Modify the delta.
double & Reward()
Modify the value of the deterministic parameter.
double Reward() const
Get the value of the reward parameter.
bool & Deterministic()
Modify the value of the deterministic parameter.
bool Deterministic() const
Get the value of the deterministic parameter.
InputDataType & InputParameter() const
Get the input parameter.
OutputDataType & OutputParameter() const
Get the output parameter.
void serialize(Archive &, const unsigned int)
Serialize the layer.