RECEPTIVE FIELD

Ch 3 ▸ Stride, padding and dilation ▸ Module 1/4

  1. 1Stride
  2. 2Padding
  3. 3Dilation
  4. 4Putting it together

Stride.

Stride is how far the kernel moves between one output and the next, counted in pixels. With stride 1 the kernel moves one pixel at a time and stops at every position it fits. With stride 2 it moves two pixels at a time, so it skips every other position.

FIG 3.1A ▸ INPUT x16×16
The input x, 16×16. The highlighted squares are the nine pixels the kernel reads.
FIG 3.1B ▸ OUTPUT y14×14
DARKBRIGHT
The output map y, 14×14, written one dot product at a time. Every weight is positive, so the output is shaded like the input: brighter means a larger value.
0/0 OUTPUTS · SWEEP 0.0 S
Stride

Counting the outputs

Every position where the kernel stops produces one output, so counting outputs means counting stops. Take a single row of 16 pixels, numbered 0 to 15, and a kernel 3 pixels wide.

The kernel’s left edge can start at pixel 0. The latest it can start is pixel 13, because a kernel starting there covers pixels 13, 14 and 15, the last three. Any later and it would hang off the end of the row. In general, the last start is the row length minus the kernel width: 16 − 3 = 13.

From there, stride decides which starts between 0 and 13 the kernel actually uses:

Columns work exactly the same way, so a 16×16 image gives a 14×14 output map at stride 1, 7×7 at stride 2 and 5×5 at stride 3. Check these against figure 3.1b.

Why use a bigger stride

Going from stride 1 to stride 2 roughly halves the outputs along each axis. The map is two-dimensional, so the total drops to roughly a quarter: 14 × 14 = 196 outputs become 7 × 7 = 49.

Making a map smaller like this is called downsampling: the new map has fewer values, and each one summarizes a bigger patch of the original. Downsampling makes every later layer cheaper to compute. Stride is the simplest way to do it, because the convolution and the shrinking happen in a single step.

Stride 3 shows the catch. Its last start is pixel 12, which covers pixels 12 to 14, so pixel 15 is never read at all. Whenever the stride doesn’t divide evenly into the room available, the leftover pixels at the far edge are skipped. You’ll see this rounding again when the settings come together in the last module.

Knowledge check ▸ 3 questions

Before you move on.

Answer every question correctly to unlock the next module. A wrong answer gets a hint, and you can try again as many times as you like.

  1. 1What does stride control?

  2. 2A row of 20 pixels, a kernel 3 pixels wide, stride 2. How many outputs does the row produce?

  3. 3Going from stride 1 to stride 2, the total number of output values becomes roughly…

0 of 3 answered correctly.

🔒 Next module: Padding