mlpack
Public Member Functions | List of all members
mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType > Class Template Reference

Implementation of the Transposed Convolution class. More...

#include <transposed_convolution.hpp>

Public Member Functions

 TransposedConvolution ()
 Create the Transposed Convolution object.
 
 TransposedConvolution (const size_t inSize, const size_t outSize, const size_t kernelWidth, const size_t kernelHeight, const size_t strideWidth=1, const size_t strideHeight=1, const size_t padW=0, const size_t padH=0, const size_t inputWidth=0, const size_t inputHeight=0, const size_t outputWidth=0, const size_t outputHeight=0, const std::string &paddingType="None")
 Create the Transposed Convolution object using the specified number of input maps, output maps, filter size, stride and padding parameter. More...
 
 TransposedConvolution (const size_t inSize, const size_t outSize, const size_t kernelWidth, const size_t kernelHeight, const size_t strideWidth, const size_t strideHeight, const std::tuple< size_t, size_t > &padW, const std::tuple< size_t, size_t > &padH, const size_t inputWidth=0, const size_t inputHeight=0, const size_t outputWidth=0, const size_t outputHeight=0, const std::string &paddingType="None")
 Create the Transposed Convolution object using the specified number of input maps, output maps, filter size, stride and padding parameter. More...
 
void Reset ()
 
template<typename eT >
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 activity forward through f. More...
 
template<typename eT >
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 backwards through f. More...
 
template<typename eT >
void Gradient (const arma::Mat< eT > &, const arma::Mat< eT > &error, arma::Mat< eT > &gradient)
 
OutputDataType const & Parameters () const
 Get the parameters.
 
OutputDataType & Parameters ()
 Modify the parameters.
 
arma::cube const & Weight () const
 Get the weight of the layer.
 
arma::cube & Weight ()
 Modify the weight of the layer.
 
arma::mat const & Bias () const
 Get the bias of the layer.
 
arma::mat & Bias ()
 Modify the bias of the layer.
 
InputDataType const & InputParameter () const
 Get the input parameter.
 
InputDataType & InputParameter ()
 Modify the input parameter.
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
OutputDataType const & Gradient () const
 Get the gradient.
 
OutputDataType & Gradient ()
 Modify the gradient.
 
size_t InputWidth () const
 Get the input width.
 
size_t & InputWidth ()
 Modify input the width.
 
size_t InputHeight () const
 Get the input height.
 
size_t & InputHeight ()
 Modify the input height.
 
size_t OutputWidth () const
 Get the output width.
 
size_t & OutputWidth ()
 Modify the output width.
 
size_t OutputHeight () const
 Get the output height.
 
size_t & OutputHeight ()
 Modify the output height.
 
size_t InputSize () const
 Get the input size.
 
size_t OutputSize () const
 Get the output size.
 
size_t KernelWidth () const
 Get the kernel width.
 
size_t & KernelWidth ()
 Modify the kernel width.
 
size_t KernelHeight () const
 Get the kernel height.
 
size_t & KernelHeight ()
 Modify the kernel height.
 
size_t StrideWidth () const
 Get the stride width.
 
size_t & StrideWidth ()
 Modify the stride width.
 
size_t StrideHeight () const
 Get the stride height.
 
size_t & StrideHeight ()
 Modify the stride height.
 
size_t PadHTop () const
 Get the top padding height.
 
size_t & PadHTop ()
 Modify the top padding height.
 
size_t PadHBottom () const
 Get the bottom padding height.
 
size_t & PadHBottom ()
 Modify the bottom padding height.
 
size_t PadWLeft () const
 Get the left padding width.
 
size_t & PadWLeft ()
 Modify the left padding width.
 
size_t PadWRight () const
 Get the right padding width.
 
size_t & PadWRight ()
 Modify the right padding width.
 
size_t InputShape () const
 Get the shape of the input.
 
size_t WeightSize () const
 Get the size of the weight matrix.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename ForwardConvolutionRule = NaiveConvolution<ValidConvolution>, typename BackwardConvolutionRule = NaiveConvolution<ValidConvolution>, typename GradientConvolutionRule = NaiveConvolution<ValidConvolution>, typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType >

Implementation of the Transposed Convolution class.

The Transposed Convolution class represents a single layer of a neural network.

Template Parameters
ForwardConvolutionRuleConvolution to perform forward process.
BackwardConvolutionRuleConvolution to perform backward process.
GradientConvolutionRuleConvolution to calculate gradient.
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ TransposedConvolution() [1/2]

template<typename ForwardConvolutionRule , typename BackwardConvolutionRule , typename GradientConvolutionRule , typename InputDataType , typename OutputDataType >
mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType >::TransposedConvolution ( const size_t  inSize,
const size_t  outSize,
const size_t  kernelWidth,
const size_t  kernelHeight,
const size_t  strideWidth = 1,
const size_t  strideHeight = 1,
const size_t  padW = 0,
const size_t  padH = 0,
const size_t  inputWidth = 0,
const size_t  inputHeight = 0,
const size_t  outputWidth = 0,
const size_t  outputHeight = 0,
const std::string &  paddingType = "None" 
)

Create the Transposed Convolution object using the specified number of input maps, output maps, filter size, stride and padding parameter.

Note: The equivalent stride of a transposed convolution operation is always equal to 1. In this implementation, stride of filter represents the stride of the associated convolution operation. Note: Padding of input represents padding of associated convolution operation.

Parameters
inSizeThe number of input maps.
outSizeThe number of output maps.
kernelWidthWidth of the filter/kernel.
kernelHeightHeight of the filter/kernel.
strideWidthStride of filter application in the x direction.
strideHeightStride of filter application in the y direction.
padWPadding width of the input.
padHPadding height of the input.
inputWidthThe width of the input data.
inputHeightThe height of the input data.
outputWidthThe width of the output data.
outputHeightThe height of the output data.
paddingTypeThe type of padding (Valid or Same). Defaults to None.

◆ TransposedConvolution() [2/2]

template<typename ForwardConvolutionRule , typename BackwardConvolutionRule , typename GradientConvolutionRule , typename InputDataType , typename OutputDataType >
mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType >::TransposedConvolution ( const size_t  inSize,
const size_t  outSize,
const size_t  kernelWidth,
const size_t  kernelHeight,
const size_t  strideWidth,
const size_t  strideHeight,
const std::tuple< size_t, size_t > &  padW,
const std::tuple< size_t, size_t > &  padH,
const size_t  inputWidth = 0,
const size_t  inputHeight = 0,
const size_t  outputWidth = 0,
const size_t  outputHeight = 0,
const std::string &  paddingType = "None" 
)

Create the Transposed Convolution object using the specified number of input maps, output maps, filter size, stride and padding parameter.

Note: The equivalent stride of a transposed convolution operation is always equal to 1. In this implementation, stride of filter represents the stride of the associated convolution operation. Note: Padding of input represents padding of associated convolution operation.

Parameters
inSizeThe number of input maps.
outSizeThe number of output maps.
kernelWidthWidth of the filter/kernel.
kernelHeightHeight of the filter/kernel.
strideWidthStride of filter application in the x direction.
strideHeightStride of filter application in the y direction.
padWA two-value tuple indicating padding widths of the input. First value is padding at left side. Second value is padding on right side.
padHA two-value tuple indicating padding heights of the input. First value is padding at top. Second value is padding on bottom.
inputWidthThe width of the input data.
inputHeightThe height of the input data.
outputWidthThe width of the output data.
outputHeightThe height of the output data.
paddingTypeThe type of padding (Valid or Same). Defaults to None.

Member Function Documentation

◆ Backward()

template<typename ForwardConvolutionRule , typename BackwardConvolutionRule , typename GradientConvolutionRule , typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType >::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 backwards through f.

Using the results from the feed forward pass.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Forward()

template<typename ForwardConvolutionRule , typename BackwardConvolutionRule , typename GradientConvolutionRule , typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::TransposedConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputDataType, OutputDataType >::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 activity forward through f.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

The documentation for this class was generated from the following files: