When configuring a convolutional layer, an engineer sets the padding parameter to 'same' instead of 'valid'. What does this padding parameter actually control?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Padding is all about controlling the output size of your feature map. When you set padding to 'same,' the layer adds a border of zeros around the input before the filter slides over it, specifically so that after the convolution, the output width and height match the input width and height. Without that border, using 'valid' padding, the output shrinks a bit every time the filter can't fully cover the edges. So padding isn't about normalizing pixel values, that's a preprocessing step. It's not randomly masking pixels, that's more like a data augmentation or dropout-style technique. And it has nothing to do with the number of filters, that's a completely separate hyperparameter, filter count and padding are configured independently.
Full explanation below image
Full Explanation
The padding parameter in a convolutional layer controls how many rows and columns of (typically zero-valued) pixels are added around the border of the input feature map before the convolution operation slides the filter across it. This directly determines the spatial dimensions of the resulting output feature map. With 'valid' padding, no border is added, so the filter can only be centered on positions fully contained within the original input, which causes the output to be smaller than the input by an amount depending on the filter size and stride. With 'same' padding, enough zeros are added around the border so that, for a stride of 1, the output feature map has the same height and width as the input. This is useful when building deep networks where a designer wants to control depth without prematurely shrinking spatial dimensions, or when it's important to preserve exact input-output size relationships for tasks like semantic segmentation, where the final output needs to align pixel-for-pixel with the input.
The pixel-intensity normalization distractor is incorrect because standardizing pixel values to zero mean and controlled variance is a data preprocessing or input-normalization step, entirely unrelated to how a convolution operation handles spatial borders; this is typically done once before training even begins, not configured per convolutional layer as padding is. The random-masking distractor is incorrect because randomly zeroing out a fraction of input pixels describes data augmentation strategies like cutout or occlusion-robustness training, or dropout-style regularization, none of which is what the padding hyperparameter does; padding's zero border is fixed and deterministic, not random or a form of regularization. The filter-count distractor is incorrect because the number of filters (output channels) applied at a convolutional layer is governed by a completely separate parameter, often called 'filters' or 'out_channels,' which determines the depth of the output volume, whereas padding governs only the height and width, and the two hyperparameters do not influence each other.
A simple memory aid: padding answers the question 'how do we handle the edges,' and by extension, 'how big is the output going to be,' while stride and filter count answer separate questions about how far the filter moves and how many distinct feature detectors are learned at that layer.