SAME vs VALID vs REFLECT padding — what are the practical differences?
easyAnswer
- VALID = no padding (output shrinks each layer).
- SAME = pad zeros so output has same H, W as input for stride 1.
- REFLECT = pad by reflecting pixels near the boundary (avoids the 'black-edge' artifacts you get with zero-padding in segmentation / super-resolution).
- REPLICATE = pad by repeating the edge pixel.
- Choice matters for boundary quality: SAME/zero is fine for classification, REFLECT/REPLICATE for dense prediction.
Check yourself — multiple choice
- All padding modes are identical
- VALID = no pad; SAME = zero-pad; REFLECT/REPLICATE = avoid edge artifacts (useful for dense prediction)
- Only VALID exists
- REFLECT increases receptive field
REFLECT/REPLICATE keep edge quality — matters for segmentation / super-resolution.
#cnn
Practise Deep Learning
214 interview questions in this topic.
Related questions
- What inductive biases do CNNs have?
- What is the receptive field in a CNN?
- Compute the output shape of a 2D convolution with input (H, W), kernel k, stride s, padding p, dilation d.
- What is a dilated (atrous) convolution?
- What is a transposed convolution ('deconv') and its checkerboard artifact issue?
- How does a depthwise separable convolution reduce compute?