mlpack  3.4.2
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:
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
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.
layer_traits.hpp
mlpack::ann::Concatenate::Forward
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...
mlpack::ann::Concatenate::OutputParameter
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: concatenate.hpp:74
mlpack::ann::Concatenate
Implementation of the Concatenate module class.
Definition: concatenate.hpp:37
mlpack::ann::Concatenate::Concat
OutputDataType & Concat()
Modify the delta.
Definition: concatenate.hpp:86
mlpack::ann::Concatenate::Parameters
OutputDataType & Parameters()
Modify the parameters.
Definition: concatenate.hpp:71
mlpack::ann::Concatenate::Concat
OutputDataType const & Concat() const
Get the concat matrix.
Definition: concatenate.hpp:84
mlpack::ann::Concatenate::serialize
void serialize(Archive &, const unsigned int)
Serialize the layer.
Definition: concatenate.hpp:92
mlpack::ann::Concatenate::OutputParameter
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: concatenate.hpp:76
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::ann::Concatenate::Delta
OutputDataType & Delta()
Modify the delta.
Definition: concatenate.hpp:81
mlpack::ann::Concatenate::Backward
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...
mlpack::ann::Concatenate::Concatenate
Concatenate()
Create the Concatenate object using the specified number of output units.
mlpack::ann::Concatenate::Delta
OutputDataType const & Delta() const
Get the delta.
Definition: concatenate.hpp:79
mlpack::ann::Concatenate::Parameters
OutputDataType const & Parameters() const
Get the parameters.
Definition: concatenate.hpp:69