Stride changes the top-left starts where the given kernel lands. This lesson uses a separate exact image and recomputes only the selected stride-two cells.

highlighted = computed this step

Stride is the step size

This separate demo uses a 5 by 5 image, a 2 by 2 given kernel, valid padding, and stride 2. Stride changes where the kernel lands, not the dot-product arithmetic.

valid padding,stride 2\text{valid padding},\quad \text{stride }2
Stride moves the windowStride two chooses every other valid kernel landing.stride demo imagec1c2c3c4c51020301010201020101030201stride 2 selected startsc1c200022022rows 0 and 2; cols 0 and 2; row/col 1 skippedselected start (0,2) dot kernelAc1c2c3c41001·xentry2001products1·2=2Σ=2+0·0=0Σ=2+0·0=0Σ=2+1·1=1Σ=3result 3stride 2 feature mapc1c22332valid padding, stride 2kernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learningkernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learning

Selected starts

Stride 2 uses rows 0 and 2, and columns 0 and 2. Starts at row or column 1 are skipped because the step size is 2.

starts (0,0),(0,2),(2,0),(2,2)\text{starts }(0,0),(0,2),(2,0),(2,2)
Stride moves the windowStride two chooses every other valid kernel landing.stride demo imagec1c2c3c4c51020301010201020101030201stride 2 selected startsc1c200022022rows 0 and 2; cols 0 and 2; row/col 1 skippedselected start (0,2) dot kernelAc1c2c3c41001·xentry2001products1·2=2Σ=2+0·0=0Σ=2+0·0=0Σ=2+1·1=1Σ=3result 3stride 2 feature mapc1c22332valid padding, stride 2kernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learningkernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learning

Compute one selected cell

At start row 0, col 2, the exact dot product is 1·2 + 0·0 + 0·0 + 1·1 = 3.

12+00+00+11=31\cdot2 + 0\cdot0 + 0\cdot0 + 1\cdot1 = 3
Stride moves the windowStride two chooses every other valid kernel landing.stride demo imagec1c2c3c4c51020301010201020101030201stride 2 selected startsc1c200022022rows 0 and 2; cols 0 and 2; row/col 1 skippedselected start (0,2) dot kernelAc1c2c3c41001·xentry2001products1·2=2Σ=2+0·0=0Σ=2+0·0=0Σ=2+1·1=1Σ=3result 3stride 2 feature mapc1c22332valid padding, stride 2kernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learningkernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learning

The stride-two feature map

Recompute only at the selected starts. The exact stride 2 feature map is [[2, 3], [3, 2]]. This is exact forward-pass arithmetic only; the kernel is given, with NOT training and NOT learning.

[2332]\begin{bmatrix}2&3\\3&2\end{bmatrix}
Stride moves the windowStride two chooses every other valid kernel landing.stride demo imagec1c2c3c4c51020301010201020101030201stride 2 selected startsc1c200022022rows 0 and 2; cols 0 and 2; row/col 1 skippedselected start (0,2) dot kernelAc1c2c3c41001·xentry2001products1·2=2Σ=2+0·0=0Σ=2+0·0=0Σ=2+1·1=1Σ=3result 3stride 2 feature mapc1c22332valid padding, stride 2kernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learningkernel is given; valid padding and stride 2; one exact forward pass; head softmax is NAMED; NOTtraining; NOT learning