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 
45  Concatenate(const Concatenate& layer);
46 
48  Concatenate(Concatenate&& layer);
49 
51  Concatenate& operator=(const Concatenate& layer);
52 
55 
63  template<typename eT>
64  void Forward(const arma::Mat<eT>& input, arma::Mat<eT>& output);
65 
75  template<typename eT>
76  void Backward(const arma::Mat<eT>& /* input */,
77  const arma::Mat<eT>& gy,
78  arma::Mat<eT>& g);
79 
81  OutputDataType const& Parameters() const { return weights; }
83  OutputDataType& Parameters() { return weights; }
84 
86  OutputDataType const& OutputParameter() const { return outputParameter; }
88  OutputDataType& OutputParameter() { return outputParameter; }
89 
91  OutputDataType const& Delta() const { return delta; }
93  OutputDataType& Delta() { return delta; }
94 
96  OutputDataType const& Concat() const { return concat; }
98  OutputDataType& Concat() { return concat; }
99 
103  template<typename Archive>
104  void serialize(Archive& /* ar */, const uint32_t /* version */)
105  {
106  // Nothing to do here.
107  }
108 
109  private:
111  size_t inRows;
112 
114  OutputDataType weights;
115 
117  OutputDataType delta;
118 
120  OutputDataType outputParameter;
121 
123  OutputDataType concat;
124 }; // class Concatenate
125 
126 } // namespace ann
127 } // namespace mlpack
128 
129 // Include implementation.
130 #include "concatenate_impl.hpp"
131 
132 #endif
Concatenate()
Create the Concatenate object using the specified number of output units.
OutputDataType const & Parameters() const
Get the parameters.
Definition: concatenate.hpp:81
Implementation of the Concatenate module class.
Definition: concatenate.hpp:36
void serialize(Archive &, const uint32_t)
Serialize the layer.
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...
Linear algebra utility functions, generally performed on matrices or vectors.
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: concatenate.hpp:86
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & Parameters()
Modify the parameters.
Definition: concatenate.hpp:83
OutputDataType const & Concat() const
Get the concat matrix.
Definition: concatenate.hpp:96
Concatenate & operator=(const Concatenate &layer)
Operator= copy constructor.
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 & Concat()
Modify the concat.
Definition: concatenate.hpp:98
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: concatenate.hpp:88
OutputDataType & Delta()
Modify the delta.
Definition: concatenate.hpp:93
OutputDataType const & Delta() const
Get the delta.
Definition: concatenate.hpp:91