bicubic_interpolation.hpp
Go to the documentation of this file.
1 
10 #ifndef MLPACK_METHODS_ANN_LAYER_BICUBIC_INTERPOLATION_HPP
11 #define MLPACK_METHODS_ANN_LAYER_BICUBIC_INTERPOLATION_HPP
12 
13 #include <mlpack/prereqs.hpp>
14 
15 namespace mlpack {
16 namespace ann {
17 
34 template <
35  typename InputDataType = arma::mat,
36  typename OutputDataType = arma::mat
37 >
39 {
40  public:
43 
53  BicubicInterpolation(const size_t inRowSize,
54  const size_t inColSize,
55  const size_t outRowSize,
56  const size_t outColSize,
57  const size_t depth,
58  const double alpha = -0.75);
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 
86  void GetKernalWeight(double delta, arma::mat& coeffs);
87 
89  OutputDataType const& OutputParameter() const { return outputParameter; }
91  OutputDataType& OutputParameter() { return outputParameter; }
92 
94  OutputDataType const& Delta() const { return delta; }
96  OutputDataType& Delta() { return delta; }
97 
99  OutputDataType const& Parameters() const { return weights; }
101  OutputDataType& Parameters() { return weights; }
102 
104  size_t const& InRowSize() const { return inRowSize; }
106  size_t& InRowSize() { return inRowSize; }
107 
109  size_t const& InColSize() const { return inColSize; }
111  size_t& InColSize() { return inColSize; }
112 
114  size_t const& OutRowSize() const { return outRowSize; }
116  size_t& OutRowSize() { return outRowSize; }
117 
119  size_t const& OutColSize() const { return outColSize; }
121  size_t& OutColSize() { return outColSize; }
122 
124  size_t const& InDepth() const { return depth; }
126  size_t& InDepth() { return depth; }
127 
129  double const& Alpha() const { return alpha; }
131  double& Alpha() { return alpha; }
132 
134  size_t InputShape() const
135  {
136  return inRowSize;
137  }
138 
142  template<typename Archive>
143  void serialize(Archive& ar, const uint32_t /* version */);
144 
145  private:
147  typedef typename OutputDataType::elem_type ElemType;
148 
150  size_t inRowSize;
152  size_t inColSize;
154  size_t outRowSize;
156  size_t outColSize;
158  size_t depth;
160  double alpha;
162  size_t batchSize;
164  OutputDataType delta;
166  OutputDataType outputParameter;
168  OutputDataType weights;
169 }; // class BicubicInterpolation
170 
171 } // namespace ann
172 } // namespace mlpack
173 
174 // Include implementation.
175 #include "bicubic_interpolation_impl.hpp"
176 
177 #endif
size_t const & InDepth() const
Get the depth of the input.
Linear algebra utility functions, generally performed on matrices or vectors.
size_t & InColSize()
Modify the column size of the input.
OutputDataType const & OutputParameter() const
Get the output parameter.
OutputDataType & Parameters()
Modify the parameters.
OutputDataType const & Delta() const
Get the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t & InRowSize()
Modify the row size of the input.
double & Alpha()
Modify the constant value to generate weight.
OutputDataType const & Parameters() const
Get the parameters.
double const & Alpha() const
Get the constant value to generate weight.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
size_t const & OutRowSize() const
Get the row size of the output.
size_t & OutRowSize()
Modify the row size of the output.
OutputDataType & Delta()
Modify the delta.
size_t const & OutColSize() const
Get the column size of the output.
Definition and Implementation of the Bicubic Interpolation Layer.
size_t & InDepth()
Modify the depth of the input.
size_t & OutColSize()
Modify the column 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...
void GetKernalWeight(double delta, arma::mat &coeffs)
size_t const & InRowSize() const
Get the row size of the input.
OutputDataType & OutputParameter()
Modify the output parameter.
size_t InputShape() const
Get the shape of the input.
BicubicInterpolation()
Create the Bicubic Interpolation object.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass through the layer.
size_t const & InColSize() const
Get the column size of the input.