bilinear_interpolation.hpp
Go to the documentation of this file.
1 
11 #ifndef MLPACK_METHODS_ANN_LAYER_BILINEAR_INTERPOLATION_HPP
12 #define MLPACK_METHODS_ANN_LAYER_BILINEAR_INTERPOLATION_HPP
13 
14 #include <mlpack/prereqs.hpp>
15 
16 namespace mlpack {
17 namespace ann {
18 
35 template <
36  typename InputDataType = arma::mat,
37  typename OutputDataType = arma::mat
38 >
40 {
41  public:
44 
54  BilinearInterpolation(const size_t inRowSize,
55  const size_t inColSize,
56  const size_t outRowSize,
57  const size_t outColSize,
58  const size_t depth);
59 
67  template<typename eT>
68  void Forward(const arma::Mat<eT>& input, arma::Mat<eT>& output);
69 
81  template<typename eT>
82  void Backward(const arma::Mat<eT>& /*input*/,
83  const arma::Mat<eT>& gradient,
84  arma::Mat<eT>& output);
85 
87  OutputDataType const& OutputParameter() const { return outputParameter; }
89  OutputDataType& OutputParameter() { return outputParameter; }
90 
92  OutputDataType const& Delta() const { return delta; }
94  OutputDataType& Delta() { return delta; }
95 
97  size_t const& InRowSize() const { return inRowSize; }
99  size_t& InRowSize() { return inRowSize; }
100 
102  size_t const& InColSize() const { return inColSize; }
104  size_t& InColSize() { return inColSize; }
105 
107  size_t const& OutRowSize() const { return outRowSize; }
109  size_t& OutRowSize() { return outRowSize; }
110 
112  size_t const& OutColSize() const { return outColSize; }
114  size_t& OutColSize() { return outColSize; }
115 
117  size_t const& InDepth() const { return depth; }
119  size_t& InDepth() { return depth; }
120 
122  size_t InputShape() const
123  {
124  return inRowSize;
125  }
126 
130  template<typename Archive>
131  void serialize(Archive& ar, const uint32_t /* version */);
132 
133  private:
135  size_t inRowSize;
137  size_t inColSize;
139  size_t outRowSize;
141  size_t outColSize;
143  size_t depth;
145  size_t batchSize;
147  OutputDataType delta;
149  OutputDataType outputParameter;
150 }; // class BilinearInterpolation
151 
152 } // namespace ann
153 } // namespace mlpack
154 
155 // Include implementation.
156 #include "bilinear_interpolation_impl.hpp"
157 
158 #endif
OutputDataType const & OutputParameter() const
Get the output parameter.
size_t const & InRowSize() const
Get the row size of the input.
Linear algebra utility functions, generally performed on matrices or vectors.
size_t & InDepth()
Modify the depth of the input.
OutputDataType & Delta()
Modify the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t const & OutColSize() const
Get the column size of the output.
size_t & OutColSize()
Modify the column size of the output.
size_t & OutRowSize()
Modify the row size of the output.
size_t InputShape() const
Get the shape of the input.
size_t const & InDepth() const
Get the depth of the input.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass through the layer.
size_t & InColSize()
Modify the column size of the input.
OutputDataType const & Delta() const
Get the delta.
size_t const & OutRowSize() const
Get the row size of the output.
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...
BilinearInterpolation()
Create the Bilinear Interpolation object.
size_t & InRowSize()
Modify the row size of the input.
Definition and Implementation of the Bilinear Interpolation Layer.
size_t const & InColSize() const
Get the column size of the input.