concatenate.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_CONCATENATE_HPP
14 #define MLPACK_METHODS_ANN_LAYER_CONCATENATE_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace ann {
21 
32 template <
33  typename InputDataType = arma::mat,
34  typename OutputDataType = arma::mat
35 >
37 {
38  public:
42  Concatenate();
43 
51  template<typename eT>
52  void Forward(const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
53 
63  template<typename eT>
64  void Backward(const arma::Mat<eT>&& /* input */,
65  const arma::Mat<eT>&& gy,
66  arma::Mat<eT>&& g);
67 
69  OutputDataType const& Parameters() const { return weights; }
71  OutputDataType& Parameters() { return weights; }
72 
74  OutputDataType const& OutputParameter() const { return outputParameter; }
76  OutputDataType& OutputParameter() { return outputParameter; }
77 
79  OutputDataType const& Delta() const { return delta; }
81  OutputDataType& Delta() { return delta; }
82 
84  OutputDataType const& Concat() const { return concat; }
86  OutputDataType& Concat() { return concat; }
87 
91  template<typename Archive>
92  void serialize(Archive& /* ar */, const unsigned int /* version */)
93  {
94  // Nothing to do here.
95  }
96 
97  private:
99  size_t inRows;
100 
102  OutputDataType weights;
103 
105  OutputDataType delta;
106 
108  OutputDataType outputParameter;
109 
111  OutputDataType concat;
112 }; // class Concatenate
113 
114 } // namespace ann
115 } // namespace mlpack
116 
117 // Include implementation.
118 #include "concatenate_impl.hpp"
119 
120 #endif
Concatenate()
Create the Concatenate object using the specified number of output units.
OutputDataType const & Parameters() const
Get the parameters.
Definition: concatenate.hpp:69
void serialize(Archive &, const unsigned int)
Serialize the layer.
Definition: concatenate.hpp:92
Implementation of the Concatenate module class.
Definition: concatenate.hpp:36
.hpp
Definition: add_to_po.hpp:21
void Backward(const arma::Mat< eT > &&, const arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: concatenate.hpp:74
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & Parameters()
Modify the parameters.
Definition: concatenate.hpp:71
OutputDataType const & Concat() const
Get the concat matrix.
Definition: concatenate.hpp:84
OutputDataType & Concat()
Modify the delta.
Definition: concatenate.hpp:86
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: concatenate.hpp:76
OutputDataType & Delta()
Modify the delta.
Definition: concatenate.hpp:81
OutputDataType const & Delta() const
Get the delta.
Definition: concatenate.hpp:79
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...