Implementation of the Transposed Convolution class. More...
Public Member Functions | |
| TransposedConvolution () | |
| Create the Transposed Convolution object. More... | |
| 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... | |
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... | |
| arma::mat const & | Bias () const |
| Get the bias of the layer. More... | |
| arma::mat & | Bias () |
| Modify the bias of the layer. More... | |
| OutputDataType const & | Delta () const |
| Get the delta. More... | |
| OutputDataType & | Delta () |
| Modify the delta. More... | |
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 | Gradient (const arma::Mat< eT > &, const arma::Mat< eT > &error, arma::Mat< eT > &gradient) |
| OutputDataType const & | Gradient () const |
| Get the gradient. More... | |
| OutputDataType & | Gradient () |
| Modify the gradient. More... | |
| size_t | InputHeight () const |
| Get the input height. More... | |
| size_t & | InputHeight () |
| Modify the input height. More... | |
| InputDataType const & | InputParameter () const |
| Get the input parameter. More... | |
| InputDataType & | InputParameter () |
| Modify the input parameter. More... | |
| size_t | InputShape () const |
| Get the shape of the input. More... | |
| size_t | InputSize () const |
| Get the input size. More... | |
| size_t | InputWidth () const |
| Get the input width. More... | |
| size_t & | InputWidth () |
| Modify input the width. More... | |
| size_t | KernelHeight () const |
| Get the kernel height. More... | |
| size_t & | KernelHeight () |
| Modify the kernel height. More... | |
| size_t | KernelWidth () const |
| Get the kernel width. More... | |
| size_t & | KernelWidth () |
| Modify the kernel width. More... | |
| size_t | OutputHeight () const |
| Get the output height. More... | |
| size_t & | OutputHeight () |
| Modify the output height. More... | |
| OutputDataType const & | OutputParameter () const |
| Get the output parameter. More... | |
| OutputDataType & | OutputParameter () |
| Modify the output parameter. More... | |
| size_t | OutputSize () const |
| Get the output size. More... | |
| size_t | OutputWidth () const |
| Get the output width. More... | |
| size_t & | OutputWidth () |
| Modify the output width. More... | |
| size_t | PadHBottom () const |
| Get the bottom padding height. More... | |
| size_t & | PadHBottom () |
| Modify the bottom padding height. More... | |
| size_t | PadHTop () const |
| Get the top padding height. More... | |
| size_t & | PadHTop () |
| Modify the top padding height. More... | |
| size_t | PadWLeft () const |
| Get the left padding width. More... | |
| size_t & | PadWLeft () |
| Modify the left padding width. More... | |
| size_t | PadWRight () const |
| Get the right padding width. More... | |
| size_t & | PadWRight () |
| Modify the right padding width. More... | |
| OutputDataType const & | Parameters () const |
| Get the parameters. More... | |
| OutputDataType & | Parameters () |
| Modify the parameters. More... | |
| void | Reset () |
template < typename Archive > | |
| void | serialize (Archive &ar, const uint32_t) |
| Serialize the layer. More... | |
| size_t | StrideHeight () const |
| Get the stride height. More... | |
| size_t & | StrideHeight () |
| Modify the stride height. More... | |
| size_t | StrideWidth () const |
| Get the stride width. More... | |
| size_t & | StrideWidth () |
| Modify the stride width. More... | |
| arma::cube const & | Weight () const |
| Get the weight of the layer. More... | |
| arma::cube & | Weight () |
| Modify the weight of the layer. More... | |
| size_t | WeightSize () const |
| Get the size of the weight matrix. More... | |
Implementation of the Transposed Convolution class.
The Transposed Convolution class represents a single layer of a neural network.
| ForwardConvolutionRule | Convolution to perform forward process. |
| BackwardConvolutionRule | Convolution to perform backward process. |
| GradientConvolutionRule | Convolution to calculate gradient. |
| InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
| OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 190 of file layer_types.hpp.
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.
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.
| inSize | The number of input maps. |
| outSize | The number of output maps. |
| kernelWidth | Width of the filter/kernel. |
| kernelHeight | Height of the filter/kernel. |
| strideWidth | Stride of filter application in the x direction. |
| strideHeight | Stride of filter application in the y direction. |
| padW | Padding width of the input. |
| padH | Padding height of the input. |
| inputWidth | The width of the input data. |
| inputHeight | The height of the input data. |
| outputWidth | The width of the output data. |
| outputHeight | The height of the output data. |
| paddingType | The type of padding (Valid or Same). Defaults to None. |
| 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.
| inSize | The number of input maps. |
| outSize | The number of output maps. |
| kernelWidth | Width of the filter/kernel. |
| kernelHeight | Height of the filter/kernel. |
| strideWidth | Stride of filter application in the x direction. |
| strideHeight | Stride of filter application in the y direction. |
| padW | A two-value tuple indicating padding widths of the input. First value is padding at left side. Second value is padding on right side. |
| padH | A two-value tuple indicating padding heights of the input. First value is padding at top. Second value is padding on bottom. |
| inputWidth | The width of the input data. |
| inputHeight | The height of the input data. |
| outputWidth | The width of the output data. |
| outputHeight | The height of the output data. |
| paddingType | The type of padding (Valid or Same). Defaults to None. |
| 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.
Using the results from the feed forward pass.
| * | (input) The propagated input activation. |
| gy | The backpropagated error. |
| g | The calculated gradient. |
|
inline |
Get the bias of the layer.
Definition at line 187 of file transposed_convolution.hpp.
|
inline |
Modify the bias of the layer.
Definition at line 189 of file transposed_convolution.hpp.
|
inline |
Get the delta.
Definition at line 202 of file transposed_convolution.hpp.
|
inline |
Modify the delta.
Definition at line 204 of file transposed_convolution.hpp.
| 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.
| input | Input data used for evaluating the specified function. |
| output | Resulting output activation. |
| void Gradient | ( | const arma::Mat< eT > & | , |
| const arma::Mat< eT > & | error, | ||
| arma::Mat< eT > & | gradient | ||
| ) |
|
inline |
Get the gradient.
Definition at line 207 of file transposed_convolution.hpp.
|
inline |
Modify the gradient.
Definition at line 209 of file transposed_convolution.hpp.
|
inline |
Get the input height.
Definition at line 217 of file transposed_convolution.hpp.
|
inline |
Modify the input height.
Definition at line 219 of file transposed_convolution.hpp.
|
inline |
Get the input parameter.
Definition at line 192 of file transposed_convolution.hpp.
|
inline |
Modify the input parameter.
Definition at line 194 of file transposed_convolution.hpp.
|
inline |
Get the shape of the input.
Definition at line 278 of file transposed_convolution.hpp.
|
inline |
Get the input size.
Definition at line 232 of file transposed_convolution.hpp.
|
inline |
Get the input width.
Definition at line 212 of file transposed_convolution.hpp.
|
inline |
Modify input the width.
Definition at line 214 of file transposed_convolution.hpp.
|
inline |
Get the kernel height.
Definition at line 243 of file transposed_convolution.hpp.
|
inline |
Modify the kernel height.
Definition at line 245 of file transposed_convolution.hpp.
|
inline |
Get the kernel width.
Definition at line 238 of file transposed_convolution.hpp.
|
inline |
Modify the kernel width.
Definition at line 240 of file transposed_convolution.hpp.
|
inline |
Get the output height.
Definition at line 227 of file transposed_convolution.hpp.
|
inline |
Modify the output height.
Definition at line 229 of file transposed_convolution.hpp.
|
inline |
Get the output parameter.
Definition at line 197 of file transposed_convolution.hpp.
|
inline |
Modify the output parameter.
Definition at line 199 of file transposed_convolution.hpp.
|
inline |
Get the output size.
Definition at line 235 of file transposed_convolution.hpp.
|
inline |
Get the output width.
Definition at line 222 of file transposed_convolution.hpp.
|
inline |
Modify the output width.
Definition at line 224 of file transposed_convolution.hpp.
|
inline |
Get the bottom padding height.
Definition at line 263 of file transposed_convolution.hpp.
|
inline |
Modify the bottom padding height.
Definition at line 265 of file transposed_convolution.hpp.
|
inline |
Get the top padding height.
Definition at line 258 of file transposed_convolution.hpp.
|
inline |
Modify the top padding height.
Definition at line 260 of file transposed_convolution.hpp.
|
inline |
Get the left padding width.
Definition at line 268 of file transposed_convolution.hpp.
|
inline |
Modify the left padding width.
Definition at line 270 of file transposed_convolution.hpp.
|
inline |
Get the right padding width.
Definition at line 273 of file transposed_convolution.hpp.
|
inline |
Modify the right padding width.
Definition at line 275 of file transposed_convolution.hpp.
|
inline |
Get the parameters.
Definition at line 177 of file transposed_convolution.hpp.
|
inline |
Modify the parameters.
Definition at line 179 of file transposed_convolution.hpp.
| void Reset | ( | ) |
| void serialize | ( | Archive & | ar, |
| const uint32_t | |||
| ) |
Serialize the layer.
|
inline |
Get the stride height.
Definition at line 253 of file transposed_convolution.hpp.
|
inline |
Modify the stride height.
Definition at line 255 of file transposed_convolution.hpp.
|
inline |
Get the stride width.
Definition at line 248 of file transposed_convolution.hpp.
|
inline |
Modify the stride width.
Definition at line 250 of file transposed_convolution.hpp.
|
inline |
Get the weight of the layer.
Definition at line 182 of file transposed_convolution.hpp.
|
inline |
Modify the weight of the layer.
Definition at line 184 of file transposed_convolution.hpp.
|
inline |
Get the size of the weight matrix.
Definition at line 284 of file transposed_convolution.hpp.