multiply_constant.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_MULTIPLY_CONSTANT_HPP
14 #define MLPACK_METHODS_ANN_LAYER_MULTIPLY_CONSTANT_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:
40  MultiplyConstant(const double scalar = 1.0);
41 
49  template<typename InputType, typename OutputType>
50  void Forward(const InputType&& input, OutputType&& output);
51 
60  template<typename DataType>
61  void Backward(const DataType&& /* input */, DataType&& gy, DataType&& g);
62 
64  OutputDataType& OutputParameter() const { return outputParameter; }
66  OutputDataType& OutputParameter() { return outputParameter; }
67 
69  OutputDataType& Delta() const { return delta; }
71  OutputDataType& Delta() { return delta; }
72 
76  template<typename Archive>
77  void serialize(Archive& ar, const unsigned int /* version */);
78 
79  private:
81  double scalar;
82 
84  OutputDataType delta;
85 
87  OutputDataType outputParameter;
88 }; // class MultiplyConstant
89 
90 } // namespace ann
91 } // namespace mlpack
92 
93 // Include implementation.
94 #include "multiply_constant_impl.hpp"
95 
96 #endif
OutputDataType & OutputParameter()
Modify the output parameter.
.hpp
Definition: add_to_po.hpp:21
void Forward(const InputType &&input, OutputType &&output)
Ordinary feed forward pass of a neural network.
OutputDataType & Delta()
Modify the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Backward(const DataType &&, DataType &&gy, DataType &&g)
Ordinary feed backward pass of a neural network.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta() const
Get the delta.
MultiplyConstant(const double scalar=1.0)
Create the MultiplyConstant object.
Implementation of the multiply constant layer.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.