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