13 #ifndef MLPACK_METHODS_ANN_LAYER_ATROUS_CONVOLUTION_HPP 14 #define MLPACK_METHODS_ANN_LAYER_ATROUS_CONVOLUTION_HPP 45 typename ForwardConvolutionRule = NaiveConvolution<ValidConvolution>,
46 typename BackwardConvolutionRule = NaiveConvolution<FullConvolution>,
47 typename GradientConvolutionRule = NaiveConvolution<ValidConvolution>,
48 typename InputDataType = arma::mat,
49 typename OutputDataType = arma::mat
81 const size_t padW = 0,
82 const size_t padH = 0,
83 const size_t inputWidth = 0,
84 const size_t inputHeight = 0,
85 const size_t dilationW = 1,
86 const size_t dilationH = 1);
100 template<
typename eT>
101 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
112 template<
typename eT>
113 void Backward(
const arma::Mat<eT>&& ,
124 template<
typename eT>
125 void Gradient(
const arma::Mat<eT>&& ,
126 arma::Mat<eT>&& error,
127 arma::Mat<eT>&& gradient);
140 OutputDataType
const&
Delta()
const {
return delta; }
142 OutputDataType&
Delta() {
return delta; }
145 OutputDataType
const&
Gradient()
const {
return gradient; }
170 arma::mat&
Bias() {
return bias; }
175 template<
typename Archive>
176 void serialize(Archive& ar,
const unsigned int );
189 size_t ConvOutSize(
const size_t size,
195 return std::floor(size + p * 2 - d * (k - 1) - 1) / s + 1;
204 template<
typename eT>
205 void Rotate180(
const arma::Cube<eT>& input, arma::Cube<eT>& output)
207 output = arma::Cube<eT>(input.n_rows, input.n_cols, input.n_slices);
210 for (
size_t s = 0; s < output.n_slices; s++)
211 output.slice(s) = arma::fliplr(arma::flipud(input.slice(s)));
220 template<
typename eT>
221 void Rotate180(
const arma::Mat<eT>& input, arma::Mat<eT>& output)
224 output = arma::fliplr(arma::flipud(input));
255 OutputDataType weights;
282 arma::cube outputTemp;
285 arma::cube inputTemp;
288 arma::cube inputPaddedTemp;
294 arma::cube gradientTemp;
300 OutputDataType delta;
303 OutputDataType gradient;
306 OutputDataType outputParameter;
313 #include "atrous_convolution_impl.hpp" OutputDataType const & Parameters() const
Get the parameters.
OutputDataType const & OutputParameter() const
Get the output parameter.
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...
size_t const & OutputHeight() const
Get the output height.
arma::mat & Bias()
Modify the bias weights of the layer.
Implementation of the Padding module class.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
size_t & InputHeight()
Modify the input height.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t const & InputHeight() const
Get the input height.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Parameters()
Modify the parameters.
AtrousConvolution()
Create the AtrousConvolution object.
size_t const & OutputWidth() const
Get the output width.
OutputDataType const & Gradient() const
Get the gradient.
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...
size_t & InputWidth()
Modify input the width.
size_t const & InputWidth() const
Get the input width.
OutputDataType & Gradient()
Modify the gradient.
size_t & OutputWidth()
Modify the output width.
size_t & OutputHeight()
Modify the output height.
OutputDataType const & Delta() const
Get the delta.
Implementation of the Atrous Convolution class.