Implementation of the Atrous Convolution class. More...
Public Member Functions | |
AtrousConvolution () | |
Create the AtrousConvolution object. More... | |
AtrousConvolution (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 dilationWidth=1, const size_t dilationHeight=1, const std::string &paddingType="None") | |
Create the AtrousConvolution object using the specified number of input maps, output maps, filter size, stride, dilation and padding parameter. More... | |
AtrousConvolution (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 dilationWidth=1, const size_t dilationHeight=1, const std::string &paddingType="None") | |
Create the AtrousConvolution object using the specified number of input maps, output maps, filter size, stride, dilation and padding parameter. More... | |
void | Backward (const InputType &, const OutputType &gy, OutputType &g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More... | |
const OutputType & | Bias () const |
Get the bias of the layer. More... | |
OutputType & | Bias () |
Modify the bias of the layer. More... | |
const size_t & | DilationHeight () const |
Get the dilation rate on the Y axis. More... | |
size_t & | DilationHeight () |
Modify the dilation rate on the Y axis. More... | |
const size_t & | DilationWidth () const |
Get the dilation rate on the X axis. More... | |
size_t & | DilationWidth () |
Modify the dilation rate on the X axis. More... | |
void | Forward (const InputType &input, OutputType &output) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
void | Gradient (const InputType &, const OutputType &error, OutputType &gradient) |
const size_t & | InputHeight () const |
Get the input height. More... | |
size_t & | InputHeight () |
Modify the input height. More... | |
size_t | InputShape () const |
Get the shape of the input. More... | |
const size_t & | InputWidth () const |
Get the input width. More... | |
size_t & | InputWidth () |
Modify input the width. More... | |
const size_t & | KernelHeight () const |
Get the kernel height. More... | |
size_t & | KernelHeight () |
Modify the kernel height. More... | |
const size_t & | KernelWidth () const |
Get the kernel width. More... | |
size_t & | KernelWidth () |
Modify the kernel width. More... | |
const std::vector< size_t > & | OutputDimensions () const |
const size_t & | OutputHeight () const |
Get the output height. More... | |
size_t & | OutputHeight () |
Modify the output height. More... | |
const size_t & | OutputWidth () const |
Get the output width. More... | |
size_t & | OutputWidth () |
Modify the output width. More... | |
PaddingType< InputType, OutputType > const & | Padding () const |
Get the internal Padding layer. More... | |
PaddingType< InputType, OutputType > & | Padding () |
Modify the internal Padding layer. More... | |
OutputType const & | Parameters () const |
Get the parameters. More... | |
OutputType & | Parameters () |
Modify the parameters. More... | |
void | Reset () |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
const size_t & | StrideHeight () const |
Get the stride height. More... | |
size_t & | StrideHeight () |
Modify the stride height. More... | |
const size_t & | StrideWidth () const |
Get the stride width. More... | |
size_t & | StrideWidth () |
Modify the stride width. More... | |
const arma::Cube< typename OutputType::elem_type > & | Weight () const |
Get the weight of the layer. More... | |
arma::Cube< typename OutputType::elem_type > & | Weight () |
Modify the weight of the layer. More... | |
size_t | WeightSize () const |
Get size of the weight matrix. More... | |
![]() | |
Layer () | |
Default constructor. More... | |
Layer (const Layer &layer) | |
Copy constructor. This is not responsible for copying weights! More... | |
Layer (Layer &&layer) | |
Move constructor. This is not responsible for moving weights! More... | |
virtual | ~Layer () |
Default deconstructor. More... | |
virtual void | Backward (const InputType &, const InputType &, InputType &) |
Performs a backpropagation step through the layer, with respect to the given input. More... | |
virtual Layer * | Clone () const=0 |
Make a copy of the object. More... | |
virtual void | ComputeOutputDimensions () |
Compute the output dimensions. More... | |
virtual void | Forward (const InputType &, InputType &) |
Takes an input object, and computes the corresponding output of the layer. More... | |
virtual void | Forward (const InputType &, const InputType &) |
Takes an input and output object, and computes the corresponding loss of the layer. More... | |
virtual void | Gradient (const InputType &, const InputType &, InputType &) |
Computing the gradient of the layer with respect to its own input. More... | |
const std::vector< size_t > & | InputDimensions () const |
Get the input dimensions. More... | |
std::vector< size_t > & | InputDimensions () |
Modify the input dimensions. More... | |
virtual double | Loss () |
Get the layer loss. More... | |
virtual Layer & | operator= (const Layer &layer) |
Copy assignment operator. This is not responsible for copying weights! More... | |
virtual Layer & | operator= (Layer &&layer) |
Move assignment operator. This is not responsible for moving weights! More... | |
const std::vector< size_t > & | OutputDimensions () |
Get the output dimensions. More... | |
virtual size_t | OutputSize () final |
Get the number of elements in the output from this layer. More... | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
virtual void | SetWeights (typename InputType ::elem_type *) |
Reset the layer parameter. More... | |
virtual bool const & | Training () const |
Get whether the layer is currently in training mode. More... | |
virtual bool & | Training () |
Modify whether the layer is currently in training mode. More... | |
Additional Inherited Members | |
![]() | |
std::vector< size_t > | inputDimensions |
Logical input dimensions of each point. More... | |
std::vector< size_t > | outputDimensions |
Logical output dimensions of each point. More... | |
bool | training |
If true, the layer is in training mode; otherwise, it is in testing mode. More... | |
bool | validOutputDimensions |
This is true if ComputeOutputDimensions() has been called, and outputDimensions can be considered to be up-to-date. More... | |
Implementation of the Atrous Convolution class.
The Atrous Convolution class represents a single layer of a neural network. Atrous (or Dilated) Convolutions are just simple convolutions applied to input with the defined, spaces included between the kernel cells, in order to capture a larger field of reception, without having to increase dicrete kernel sizes.
ForwardConvolutionRule | Atrous Convolution to perform forward process. |
BackwardConvolutionRule | Atrous Convolution to perform backward process. |
GradientConvolutionRule | Atrous 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 53 of file atrous_convolution.hpp.
Create the AtrousConvolution object.
AtrousConvolution | ( | 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 | dilationWidth = 1 , |
||
const size_t | dilationHeight = 1 , |
||
const std::string & | paddingType = "None" |
||
) |
Create the AtrousConvolution object using the specified number of input maps, output maps, filter size, stride, dilation and padding parameter.
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 widht of the input data. |
inputHeight | The height of the input data. |
dilationWidth | The space between the cells of filters in x direction. |
dilationHeight | The space between the cells of filters in y direction. |
paddingType | The type of padding (Valid or Same). Defaults to None. |
AtrousConvolution | ( | 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 | dilationWidth = 1 , |
||
const size_t | dilationHeight = 1 , |
||
const std::string & | paddingType = "None" |
||
) |
Create the AtrousConvolution object using the specified number of input maps, output maps, filter size, stride, dilation and padding parameter.
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 widht of the input data. |
inputHeight | The height of the input data. |
dilationWidth | The space between the cells of filters in x direction. |
dilationHeight | The space between the cells of filters in y direction. |
paddingType | The type of padding (Valid/Same/None). Defaults to None. |
void Backward | ( | const InputType & | , |
const OutputType & | gy, | ||
OutputType & | 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 191 of file atrous_convolution.hpp.
|
inline |
Modify the bias of the layer.
Definition at line 193 of file atrous_convolution.hpp.
|
inline |
Get the dilation rate on the Y axis.
Definition at line 241 of file atrous_convolution.hpp.
|
inline |
Modify the dilation rate on the Y axis.
Definition at line 243 of file atrous_convolution.hpp.
|
inline |
Get the dilation rate on the X axis.
Definition at line 236 of file atrous_convolution.hpp.
|
inline |
Modify the dilation rate on the X axis.
Definition at line 238 of file atrous_convolution.hpp.
void Forward | ( | const InputType & | input, |
OutputType & | 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 InputType & | , |
const OutputType & | error, | ||
OutputType & | gradient | ||
) |
|
inline |
Get the input height.
Definition at line 201 of file atrous_convolution.hpp.
|
inline |
Modify the input height.
Definition at line 203 of file atrous_convolution.hpp.
|
inline |
Get the shape of the input.
Definition at line 257 of file atrous_convolution.hpp.
References AtrousConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputType, OutputType >::serialize(), and core::v2::size().
|
inline |
Get the input width.
Definition at line 196 of file atrous_convolution.hpp.
|
inline |
Modify input the width.
Definition at line 198 of file atrous_convolution.hpp.
|
inline |
Get the kernel height.
Definition at line 221 of file atrous_convolution.hpp.
|
inline |
Modify the kernel height.
Definition at line 223 of file atrous_convolution.hpp.
|
inline |
Get the kernel width.
Definition at line 216 of file atrous_convolution.hpp.
|
inline |
Modify the kernel width.
Definition at line 218 of file atrous_convolution.hpp.
|
inline |
Definition at line 182 of file atrous_convolution.hpp.
References Layer< InputType, OutputType >::inputDimensions.
|
inline |
Get the output height.
Definition at line 211 of file atrous_convolution.hpp.
|
inline |
Modify the output height.
Definition at line 213 of file atrous_convolution.hpp.
|
inline |
Get the output width.
Definition at line 206 of file atrous_convolution.hpp.
|
inline |
Modify the output width.
Definition at line 208 of file atrous_convolution.hpp.
|
inline |
Get the internal Padding layer.
Definition at line 246 of file atrous_convolution.hpp.
|
inline |
Modify the internal Padding layer.
Definition at line 248 of file atrous_convolution.hpp.
|
inlinevirtual |
Get the parameters.
Reimplemented from Layer< InputType, OutputType >.
Definition at line 170 of file atrous_convolution.hpp.
|
inlinevirtual |
Modify the parameters.
Reimplemented from Layer< InputType, OutputType >.
Definition at line 172 of file atrous_convolution.hpp.
void Reset | ( | ) |
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by AtrousConvolution< ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, InputType, OutputType >::InputShape().
|
inline |
Get the stride height.
Definition at line 231 of file atrous_convolution.hpp.
|
inline |
Modify the stride height.
Definition at line 233 of file atrous_convolution.hpp.
|
inline |
Get the stride width.
Definition at line 226 of file atrous_convolution.hpp.
|
inline |
Modify the stride width.
Definition at line 228 of file atrous_convolution.hpp.
|
inline |
Get the weight of the layer.
Definition at line 175 of file atrous_convolution.hpp.
|
inline |
Modify the weight of the layer.
Definition at line 180 of file atrous_convolution.hpp.
|
inlinevirtual |
Get size of the weight matrix.
Reimplemented from Layer< InputType, OutputType >.
Definition at line 251 of file atrous_convolution.hpp.