mlpack  master
join.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_JOIN_HPP
13 #define MLPACK_METHODS_ANN_LAYER_JOIN_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
29 template<
30  typename InputDataType = arma::mat,
31  typename OutputDataType = arma::mat
32 >
33 class Join
34 {
35  public:
37  Join();
38 
46  template<typename InputType, typename OutputType>
47  void Forward(const InputType&& input, OutputType&& output);
48 
58  template<typename eT>
59  void Backward(const arma::Mat<eT>&& /* input */,
60  arma::Mat<eT>&& gy,
61  arma::Mat<eT>&& g);
62 
64  InputDataType const& InputParameter() const { return inputParameter; }
66  InputDataType& InputParameter() { return inputParameter; }
67 
69  OutputDataType const& OutputParameter() const { return outputParameter; }
71  OutputDataType& OutputParameter() { return outputParameter; }
72 
74  OutputDataType const& Delta() const { return delta; }
76  OutputDataType& Delta() { return delta; }
77 
81  template<typename Archive>
82  void Serialize(Archive& ar, const unsigned int /* version */);
83 
84  private:
86  size_t inSizeRows;
87 
89  size_t inSizeCols;
90 
92  OutputDataType delta;
93 
95  InputDataType inputParameter;
96 
98  OutputDataType outputParameter;
99 }; // class Join
100 
101 } // namespace ann
102 } // namespace mlpack
103 
104 // Include implementation.
105 #include "join_impl.hpp"
106 
107 #endif
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: join.hpp:71
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
OutputDataType outputParameter
Locally-stored output parameter object.
Definition: join.hpp:98
InputDataType const & InputParameter() const
Get the input parameter.
Definition: join.hpp:64
Join()
Create the Join object.
InputDataType inputParameter
Locally-stored input parameter object.
Definition: join.hpp:95
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Backward(const arma::Mat< eT > &&, 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...
Implementation of the Join module class.
Definition: join.hpp:33
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: join.hpp:69
InputDataType & InputParameter()
Modify the input parameter.
Definition: join.hpp:66
OutputDataType const & Delta() const
Get the delta.
Definition: join.hpp:74
OutputDataType & Delta()
Modify the delta.
Definition: join.hpp:76
OutputDataType delta
Locally-stored delta object.
Definition: join.hpp:92
void Forward(const InputType &&input, OutputType &&output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
size_t inSizeRows
Locally-stored number of input rows.
Definition: join.hpp:86
void Serialize(Archive &ar, const unsigned int)
Serialize the layer.
size_t inSizeCols
Locally-stored number of input cols.
Definition: join.hpp:89