What is the difference between valid padding and same padding in a stride-1 convolution?

Deep learning, Convolutional networks
Level L1 Beginner. Length One-liner. Nature Th Theoretical.

What's being asked

Whether you can state precisely how valid and same padding treat input borders and change the output spatial size.

Key idea

Valid padding adds no zeros (p=0), so a k×k filter shrinks an n×n input to (n−k+1)×(n−k+1); same padding adds enough border zeros on each side, p=(k−1)/2 for odd kernel size k, so the output keeps the input size n×n at stride s=1.

Steps

  1. State valid padding: no zero padding (p=0), which only places the filter where it fits completely inside the input, giving output size n−k+1.
  2. State same padding: pad each side with p=(k−1)/2 zeros (for odd kernel size k) so the output height and width stay equal to n when stride s=1.
  3. Add one practical reason for same padding: without it, feature maps shrink every layer and border pixels are visited far less often than centre pixels.

Common mistakes

How long your answer should be

One or two sentences.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: What is a "dead" ReLU unit?
Next in Deep learning: When adapting a pretrained image classifier to a new dataset, when should you freeze the backbone and train only a new head versus fine-tuning the whole network?