2D Zero padding

The 2D Zero padding block adds zero values "around" the input, in order to increase its size.

The input of this block must have 3 dimensions. Padding can be applied independently in the first 2 dimensions, but the third dimension is left unchanged.

Usage in 2D operations

The precise size of tensors can be sensitive when dealing with 2D operations. It is also susceptible of changing when going through various blocks, potentially limiting compatibility between blocks.

The 2D Zero padding block allows you to control the size of a tensor by adding specific amounts of zero values on each side of its input.

Convolution example

For instance, consider that you take an input, pad it, then apply a convolution to it. You can calculate the size of the output, along a given dimension, as follows:

\[convolution\;output\;size = \frac{(input\;size+padding)-filter\;size}{stride} + 1\]

where filter size is the one along the dimension considered (i.e., Width or Height), the stride is along the same dimension (i.e., Vertical or Horizontal stride), and padding is the total amount of zeros added along that dimension.

Note that if you want the output size to be identical to the input size, you don’t have to use a padding block at all. Instead, set the Padding option of the convolution block to Same, and the right amount of padding will be applied automatically inside the convolution block.

Parameters

Top padding: The amount of zero-filled rows to add at the start of the input’s first dimension. Default: 0

Bottom padding: The amount of zero-filled rows to add at the end of the input’s first dimension. Default: 0

Left padding: The amount of zero-filled columns to add at the start of the input’s second dimension. Default: 0

Right padding: The amount of zero-filled columns to add at the end of the input’s second dimension. Default: 0