Preserving Dimensionality with Padding
In many convolutional neural network architectures, it is advantageous to keep the spatial height and width of the output identical to the input, making it easier to predict tensor shapes across deep networks. To preserve dimensionality when applying a kernel of size , we set the total number of padded rows to and the total number of padded columns to . If the kernel dimension is odd, padding is distributed evenly (e.g., rows on both sides). If the kernel dimension is even, padding is distributed asymmetrically, such as padding rows on the top and rows on the bottom. Additionally, preserving dimensionality by using an odd-sized kernel and symmetric padding provides a useful clerical benefit: it guarantees that the output element is calculated with the convolution window centered exactly on the corresponding input element .
0
1
Tags
D2L
Dive into Deep Learning @ D2L