select.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_SELECT_HPP
13 #define MLPACK_METHODS_ANN_LAYER_SELECT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
28 template <
29  typename InputDataType = arma::mat,
30  typename OutputDataType = arma::mat
31 >
32 class Select
33 {
34  public:
41  Select(const size_t index = 0, const size_t elements = 0);
42 
50  template<typename eT>
51  void Forward(const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
52 
62  template<typename eT>
63  void Backward(const arma::Mat<eT>&& /* input */,
64  arma::Mat<eT>&& gy,
65  arma::Mat<eT>&& g);
66 
68  OutputDataType& OutputParameter() const { return outputParameter; }
70  OutputDataType& OutputParameter() { return outputParameter; }
71 
73  OutputDataType& Delta() const { return delta; }
75  OutputDataType& Delta() { return delta; }
76 
80  template<typename Archive>
81  void serialize(Archive& ar, const unsigned int /* version */);
82 
83  private:
85  size_t index;
86 
88  size_t elements;
89 
91  OutputDataType delta;
92 
94  OutputDataType outputParameter;
95 }; // class Select
96 
97 } // namespace ann
98 } // namespace mlpack
99 
100 // Include implementation.
101 #include "select_impl.hpp"
102 
103 #endif
void serialize(Archive &ar, const unsigned int)
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...
OutputDataType & Delta() const
Get the delta.
Definition: select.hpp:73
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: select.hpp:70
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...
The select module selects the specified column from a given input matrix.
Definition: select.hpp:32
Select(const size_t index=0, const size_t elements=0)
Create the Select object.
OutputDataType & Delta()
Modify the delta.
Definition: select.hpp:75
OutputDataType & OutputParameter() const
Get the output parameter.
Definition: select.hpp:68