Learn Before
Code
Code Implementation of Padding in Convolution
Deep learning frameworks allow us to programmatically apply padding to convolutional layers to manage feature map sizes. For example, applying a kernel with pixel of padding on all sides to an input will preserve the input's dimensionality, resulting in an output. Similarly, if the kernel is non-square, such as , we can supply a tuple to set different padding values for the height and width (e.g., padding of for height and for width) to maintain the original spatial dimensions.
0
1
Updated 2026-05-12
Tags
D2L
Dive into Deep Learning @ D2L