12 #ifndef MLPACK_METHODS_ANN_LAYER_CONVOLUTION_HPP    13 #define MLPACK_METHODS_ANN_LAYER_CONVOLUTION_HPP    71     typename ForwardConvolutionRule = NaiveConvolution<ValidConvolution>,
    72     typename BackwardConvolutionRule = NaiveConvolution<FullConvolution>,
    73     typename GradientConvolutionRule = NaiveConvolution<ValidConvolution>,
    74     typename InputDataType = arma::mat,
    75     typename OutputDataType = arma::mat
   100               const size_t outSize,
   101               const size_t kernelWidth,
   102               const size_t kernelHeight,
   103               const size_t strideWidth = 1,
   104               const size_t strideHeight = 1,
   105               const size_t padW = 0,
   106               const size_t padH = 0,
   107               const size_t inputWidth = 0,
   108               const size_t inputHeight = 0,
   109               const std::string& paddingType = 
"None");
   132               const size_t outSize,
   133               const size_t kernelWidth,
   134               const size_t kernelHeight,
   135               const size_t strideWidth,
   136               const size_t strideHeight,
   137               const std::tuple<size_t, size_t>& padW,
   138               const std::tuple<size_t, size_t>& padH,
   139               const size_t inputWidth = 0,
   140               const size_t inputHeight = 0,
   141               const std::string& paddingType = 
"None");
   155   template<
typename eT>
   156   void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
   167   template<
typename eT>
   168   void Backward(
const arma::Mat<eT>& ,
   169                 const arma::Mat<eT>& gy,
   179   template<
typename eT>
   180   void Gradient(
const arma::Mat<eT>& ,
   181                 const arma::Mat<eT>& error,
   182                 arma::Mat<eT>& gradient);
   190   arma::cube 
const& 
Weight()
 const { 
return weight; }
   195   arma::mat 
const& 
Bias()
 const { 
return bias; }
   197   arma::mat& 
Bias() { 
return bias; }
   210   OutputDataType 
const& 
Delta()
 const { 
return delta; }
   212   OutputDataType& 
Delta() { 
return delta; }
   215   OutputDataType 
const& 
Gradient()
 const { 
return gradient; }
   288     return (outSize * inSize * kernelWidth * kernelHeight) + outSize;
   294     return inputHeight * inputWidth * inSize;
   300   template<
typename Archive>
   301   void serialize(Archive& ar, 
const uint32_t );
   314   size_t ConvOutSize(
const size_t size,
   317                      const size_t pSideOne,
   318                      const size_t pSideTwo)
   320     return std::floor(size + pSideOne + pSideTwo - k) / s + 1;
   326   void InitializeSamePadding();
   334   template<
typename eT>
   335   void Rotate180(
const arma::Cube<eT>& input, arma::Cube<eT>& output)
   337     output = arma::Cube<eT>(input.n_rows, input.n_cols, input.n_slices);
   340     for (
size_t s = 0; s < output.n_slices; s++)
   341       output.slice(s) = arma::fliplr(arma::flipud(input.slice(s)));
   350   template<
typename eT>
   351   void Rotate180(
const arma::Mat<eT>& input, arma::Mat<eT>& output)
   354     output = arma::fliplr(arma::flipud(input));
   391   OutputDataType weights;
   412   arma::cube outputTemp;
   415   arma::cube inputPaddedTemp;
   421   arma::cube gradientTemp;
   427   OutputDataType delta;
   430   OutputDataType gradient;
   433   InputDataType inputParameter;
   436   OutputDataType outputParameter;
   443 #include "convolution_impl.hpp" size_t OutputWidth() const
Get the output width. 
size_t & PadWLeft()
Modify the left padding width. 
InputDataType const  & InputParameter() const
Get the input parameter. 
size_t InputShape() const
Get the shape of the input. 
size_t & PadWRight()
Modify the right padding width. 
OutputDataType const  & Parameters() const
Get the parameters. 
Linear algebra utility functions, generally performed on matrices or vectors. 
Implementation of the Padding module class. 
size_t & OutputHeight()
Modify the output height. 
The core includes that mlpack expects; standard C++ includes and Armadillo. 
OutputDataType const  & OutputParameter() const
Get the output parameter. 
Implementation of the Convolution class. 
size_t KernelHeight() const
Get the kernel height. 
size_t PadWRight() const
Get the right padding width. 
size_t KernelWidth() const
Get the kernel width. 
size_t PadHTop() const
Get the top padding height. 
OutputDataType & Gradient()
Modify the gradient. 
size_t StrideHeight() const
Get the stride height. 
InputDataType & InputParameter()
Modify the input parameter. 
size_t InputSize() const
Get the number of input maps. 
size_t & KernelHeight()
Modify the kernel height. 
size_t & InputHeight()
Modify the input height. 
arma::mat & Bias()
Modify the bias of the layer. 
size_t & PadHTop()
Modify the top padding height. 
size_t StrideWidth() const
Get the stride width. 
arma::mat const  & Bias() const
Get the bias of the layer. 
size_t InputWidth() const
Get the input width. 
size_t InputHeight() const
Get the input height. 
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...
void serialize(Archive &ar, const uint32_t)
Serialize the layer. 
OutputDataType const  & Delta() const
Get the delta. 
void Backward(const arma::Mat< eT > &, const 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...
size_t & InputWidth()
Modify input the width. 
OutputDataType & Parameters()
Modify the parameters. 
size_t & PadHBottom()
Modify the bottom padding height. 
size_t PadWLeft() const
Get the left padding width. 
size_t WeightSize() const
Get size of weights for the layer. 
arma::cube const  & Weight() const
Get the weight of the layer. 
size_t & StrideHeight()
Modify the stride height. 
size_t & OutputWidth()
Modify the output width. 
arma::cube & Weight()
Modify the weight of the layer. 
size_t OutputHeight() const
Get the output height. 
OutputDataType & Delta()
Modify the delta. 
OutputDataType & OutputParameter()
Modify the output parameter. 
Convolution()
Create the Convolution object. 
size_t & KernelWidth()
Modify the kernel width. 
size_t & StrideWidth()
Modify the stride width. 
size_t PadHBottom() const
Get the bottom padding height. 
OutputDataType const  & Gradient() const
Get the gradient. 
size_t OutputSize() const
Get the number of output maps.