0
0
PyTorchml~5 mins

Kernel size, stride, padding in PyTorch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is kernel size in a convolutional layer?
Kernel size is the size of the small window (filter) that slides over the input image or feature map to detect patterns. For example, a 3x3 kernel looks at 3 pixels wide and 3 pixels tall at a time.
Click to reveal answer
beginner
Explain stride in convolution.
Stride is how many pixels the kernel moves each time it slides over the input. A stride of 1 moves the kernel one pixel at a time, while a stride of 2 skips one pixel, making the output smaller.
Click to reveal answer
beginner
What does padding do in convolutional layers?
Padding adds extra pixels (usually zeros) around the input edges. This helps keep the output size the same as the input or controls how much the output shrinks after convolution.
Click to reveal answer
intermediate
How does increasing stride affect the output size?
Increasing stride makes the kernel jump further each step, so the output feature map becomes smaller because fewer positions are covered.
Click to reveal answer
intermediate
Why might you use padding='same' in PyTorch convolution?
Padding='same' adds just enough padding so the output size matches the input size, which is useful when you want to keep spatial dimensions unchanged through layers.
Click to reveal answer
What does a kernel size of (5,5) mean in a convolution?
AThe filter looks at 5 pixels wide and 5 pixels tall at a time
BThe stride moves 5 pixels each step
CPadding adds 5 pixels around the input
DThe output size will be 5 times smaller
If stride=2, how does the output size change compared to stride=1?
AOutput size doubles
BOutput size becomes zero
COutput size halves approximately
DOutput size stays the same
What is the main purpose of padding in convolution?
ATo add extra pixels around input edges
BTo increase the number of channels
CTo reduce the kernel size
DTo speed up training
Which PyTorch parameter controls how far the kernel moves each step?
Akernel_size
Bdilation
Cpadding
Dstride
What happens if you use no padding with a 3x3 kernel and stride 1 on a 28x28 input?
AOutput size remains 28x28
BOutput size becomes 26x26
COutput size becomes 30x30
DOutput size becomes 1x1
Describe how kernel size, stride, and padding affect the output size of a convolutional layer.
Think about how the filter moves and how edges are handled.
You got /5 concepts.
    Explain why padding might be important when stacking many convolutional layers.
    Consider what happens to image size after many convolutions.
    You got /4 concepts.