Example

Example of Preserving Dimensionality with Padding

Deep learning frameworks allow us to programmatically apply padding to convolutional layers to manage feature map sizes. For example, applying a 3×33 \times 3 kernel with 1 pixel of padding on all sides to an 8×88 \times 8 input preserves the input's dimensionality, resulting in an 8×88 \times 8 output. Similarly, if the kernel is non-square, such as 5×35 \times 3, we can supply a tuple to set different padding values for the height and width (e.g., padding of 2 for height and 1 for width) to maintain the original spatial dimensions.

0

1

Updated 2026-06-21

Tags

D2L

Dive into Deep Learning @ D2L