Stride is the number of pixels a convolutional filter moves horizontally or vertically on each step. A stride of 1 examines neighboring positions; a larger stride skips positions and reduces the output feature map’s spatial dimensions. section 4.2.1 section 4.2.2
Stride works alongside kernel size and padding. Padding adds zeros around the input and can preserve dimensions, while increasing stride produces more downsampling. In transposed convolutional layers, the mirrored operation supports upsampling and the generation of higher-resolution feature maps. section 4.2.2 section 4.0
A 3 × 3 image with stride 2
Create a 2D convolution with a 2 × 2 kernel, stride=2, and padding=1. Padding expands the 3 × 3 input to 5 × 5 with a border of zeros. The filter then jumps two pixels at a time. With weights [[1, 2], [3, 4]] and zero bias, the output is [[4, 7], [32, 50]]. The top-left value comes from 0 × 1 + 0 × 2 + 0 × 3 + 1 × 4 = 4; the bottom-left value comes from 8 × 4 = 32. section 4.2.2
Stride in a VAE encoder
A VAE encoder can use Conv2d layers with stride 2 to compress a color image. An input shaped (3, 256, 256) becomes (8, 128, 128) after the first layer, then shrinks through additional convolutional layers before being flattened into latent representations. The decoder mirrors this structure with ConvTranspose2d layers to reconstruct an image shaped (3, 256, 256). section 7.4.1
Figure 4.5 A numerical example of how convolutional operations work, with stride equal to 1 and no padding
Use the numerical convolution diagram to trace how stride 1 scans every neighboring position before comparing it with the stride-2 case. section 4.2.1







