vr_class_reward.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_VR_CLASS_REWARD_HPP
14 #define MLPACK_METHODS_ANN_LAYER_VR_CLASS_REWARD_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 #include "layer_types.hpp"
19 
20 namespace mlpack {
21 namespace ann {
22 
34 template <
35  typename InputDataType = arma::mat,
36  typename OutputDataType = arma::mat
37 >
38 class VRClassReward
39 {
40  public:
47  VRClassReward(const double scale = 1, const bool sizeAverage = true);
48 
57  template<typename InputType, typename TargetType>
58  double Forward(const InputType&& input, const TargetType&& target);
59 
71  template<typename InputType, typename TargetType, typename OutputType>
72  void Backward(const InputType&& input,
73  const TargetType&& target,
74  OutputType&& output);
75 
77  OutputDataType& OutputParameter() const {return outputParameter; }
79  OutputDataType& OutputParameter() { return outputParameter; }
80 
82  OutputDataType& Delta() const {return delta; }
84  OutputDataType& Delta() { return delta; }
85 
87  bool Deterministic() const { return deterministic; }
89  bool& Deterministic() { return deterministic; }
90 
91  /*
92  * Add a new module to the model.
93  *
94  * @param args The layer parameter.
95  */
96  template <class LayerType, class... Args>
97  void Add(Args... args) { network.push_back(new LayerType(args...)); }
98 
99  /*
100  * Add a new module to the model.
101  *
102  * @param layer The Layer to be added to the model.
103  */
104  void Add(LayerTypes<> layer) { network.push_back(layer); }
105 
109  template<typename Archive>
110  void serialize(Archive& /* ar */, const unsigned int /* version */);
111 
112  private:
114  double scale;
115 
117  bool sizeAverage;
118 
120  double reward;
121 
123  OutputDataType delta;
124 
126  OutputDataType outputParameter;
127 
129  bool deterministic;
130 
132  std::vector<LayerTypes<> > network;
133 }; // class VRClassReward
134 
135 } // namespace ann
136 } // namespace mlpack
137 
138 // Include implementation.
139 #include "vr_class_reward_impl.hpp"
140 
141 #endif
VRClassReward(const double scale=1, const bool sizeAverage=true)
Create the VRClassReward object.
strip_type.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Forward(const InputType &&input, const TargetType &&target)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta() const
Get the delta.
void Backward(const InputType &&input, const TargetType &&target, OutputType &&output)
Ordinary feed backward pass of a neural network.
boost::variant< Add< arma::mat, arma::mat > *, AddMerge< arma::mat, arma::mat > *, AtrousConvolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, BaseLayer< LogisticFunction, arma::mat, arma::mat > *, BaseLayer< IdentityFunction, arma::mat, arma::mat > *, BaseLayer< TanhFunction, arma::mat, arma::mat > *, BaseLayer< RectifierFunction, arma::mat, arma::mat > *, BaseLayer< SoftplusFunction, arma::mat, arma::mat > *, BatchNorm< arma::mat, arma::mat > *, BilinearInterpolation< arma::mat, arma::mat > *, Concat< arma::mat, arma::mat > *, Concatenate< arma::mat, arma::mat > *, ConcatPerformance< NegativeLogLikelihood< arma::mat, arma::mat >, arma::mat, arma::mat > *, Constant< arma::mat, arma::mat > *, Convolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, TransposedConvolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< ValidConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, DropConnect< arma::mat, arma::mat > *, Dropout< arma::mat, arma::mat > *, AlphaDropout< arma::mat, arma::mat > *, ELU< arma::mat, arma::mat > *, FlexibleReLU< arma::mat, arma::mat > *, Glimpse< arma::mat, arma::mat > *, HardTanH< arma::mat, arma::mat > *, Highway< arma::mat, arma::mat > *, Join< arma::mat, arma::mat > *, LayerNorm< arma::mat, arma::mat > *, LeakyReLU< arma::mat, arma::mat > *, CReLU< arma::mat, arma::mat > *, Linear< arma::mat, arma::mat, NoRegularizer > *, LinearNoBias< arma::mat, arma::mat, NoRegularizer > *, LogSoftMax< arma::mat, arma::mat > *, Lookup< arma::mat, arma::mat > *, LSTM< arma::mat, arma::mat > *, GRU< arma::mat, arma::mat > *, FastLSTM< arma::mat, arma::mat > *, MaxPooling< arma::mat, arma::mat > *, MeanPooling< arma::mat, arma::mat > *, MiniBatchDiscrimination< arma::mat, arma::mat > *, MultiplyConstant< arma::mat, arma::mat > *, MultiplyMerge< arma::mat, arma::mat > *, NegativeLogLikelihood< arma::mat, arma::mat > *, Padding< arma::mat, arma::mat > *, PReLU< arma::mat, arma::mat > *, WeightNorm< arma::mat, arma::mat > *, MoreTypes, CustomLayers *... > LayerTypes
bool & Deterministic()
Modify the value of the deterministic parameter.
bool Deterministic() const
Get the value of the deterministic parameter.
void serialize(Archive &, const unsigned int)
Serialize the layer.
void Add(LayerTypes<> layer)
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta()
Modify the delta.