nearest_interpolation.hpp
Go to the documentation of this file.
1 
10 #ifndef MLPACK_METHODS_ANN_LAYER_NEAREST_INTERPOLATION_HPP
11 #define MLPACK_METHODS_ANN_LAYER_NEAREST_INTERPOLATION_HPP
12 
13 #include <mlpack/prereqs.hpp>
14 
15 namespace mlpack {
16 namespace ann {
17 
30 template <
31  typename InputDataType = arma::mat,
32  typename OutputDataType = arma::mat
33 >
35 {
36  public:
39 
49  NearestInterpolation(const size_t inRowSize,
50  const size_t inColSize,
51  const size_t outRowSize,
52  const size_t outColSize,
53  const size_t depth);
54 
62  template<typename eT>
63  void Forward(const arma::Mat<eT>& input, arma::Mat<eT>& output);
64 
76  template<typename eT>
77  void Backward(const arma::Mat<eT>& /*input*/,
78  const arma::Mat<eT>& gradient,
79  arma::Mat<eT>& output);
80 
82  OutputDataType const& OutputParameter() const { return outputParameter; }
84  OutputDataType& OutputParameter() { return outputParameter; }
85 
87  OutputDataType const& Delta() const { return delta; }
89  OutputDataType& Delta() { return delta; }
90 
92  size_t const& InRowSize() const { return inRowSize; }
94  size_t& InRowSize() { return inRowSize; }
95 
97  size_t const& InColSize() const { return inColSize; }
99  size_t& InColSize() { return inColSize; }
100 
102  size_t const& OutRowSize() const { return outRowSize; }
104  size_t& OutRowSize() { return outRowSize; }
105 
107  size_t const& OutColSize() const { return outColSize; }
109  size_t& OutColSize() { return outColSize; }
110 
112  size_t const& InDepth() const { return depth; }
114  size_t& InDepth() { return depth; }
115 
117  size_t InputShape() const
118  {
119  return inRowSize;
120  }
121 
125  template<typename Archive>
126  void serialize(Archive& ar, const uint32_t /* version */);
127 
128  private:
130  size_t inRowSize;
132  size_t inColSize;
134  size_t outRowSize;
136  size_t outColSize;
138  size_t depth;
140  size_t batchSize;
142  OutputDataType delta;
144  OutputDataType outputParameter;
145 }; // class NearestInterpolation
146 
147 } // namespace ann
148 } // namespace mlpack
149 
150 // Include implementation.
151 #include "nearest_interpolation_impl.hpp"
152 
153 #endif
size_t const & OutRowSize() const
Get the row size of the output.
size_t const & InDepth() const
Get the depth of the input.
size_t & InRowSize()
Modify the row size of the input.
Definition and Implementation of the Nearest Interpolation Layer.
Linear algebra utility functions, generally performed on matrices or vectors.
size_t & OutColSize()
Modify the column size of the output.
OutputDataType & Delta()
Modify the delta.
size_t const & OutColSize() const
Get the column size of the output.
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType const & OutputParameter() const
Get the output parameter.
size_t & OutRowSize()
Modify the row size of the output.
size_t InputShape() const
Get the shape of the input.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
size_t const & InRowSize() const
Get the row size of the input.
NearestInterpolation()
Create the NearestInterpolation object.
size_t & InDepth()
Modify the depth of the input.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass through the layer.
void Backward(const arma::Mat< eT > &, const arma::Mat< eT > &gradient, arma::Mat< eT > &output)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
OutputDataType const & Delta() const
Get the delta.
size_t & InColSize()
Modify the column size of the input.
size_t const & InColSize() const
Get the column size of the input.
OutputDataType & OutputParameter()
Modify the output parameter.