← Learn AI
C_000375 · deep learning · intermediate

Stride and Padding

Stride is the step between filter applications; padding adds border values so filters can cover the edges.

Step 1 of 4

In words

What it is, why it matters, and what it is like.

Why am I learning this?

Every time an image passes through a layer in a neural network, its width and height change. Stride and padding are the two controls that determine these new dimensions. With them, you can keep an image's size exactly the same as it moves deeper into the network, or shrink it deliberately to reduce the amount of data the computer must process. This control allows you to design a resolution pyramid: high detail at the start for spotting edges and textures, and broader context later for recognizing whole objects. If you do not understand these controls, you cannot predict how much information is left in your image after each step, nor can you build a model that fits your memory limits or accuracy goals.

The idea, in plain terms

Imagine you have a 5×5 grid of pixels — a small image. You want to examine it through a small window (the filter) that is 3×3. You can slide this window across the image. Two decisions control your scanning: how far you step each time (stride) and whether you can peek beyond the edges (padding).

An analogy

Think of reading a book with a magnifying glass. The glass is a 3×3 window. You move it across a page line by line. If you move it one character at a time, you examine every character — but that takes many positions. If you move it two characters at a time, you skip every second character and finish faster, but you see less detail. That is stride.

Definition

Stride is the number of steps the window moves forward after each calculation; padding is the border of extra values added around the input so the window can cover the edge pixels without shrinking the output size.

Where this sits

This concept sits inside Convolutional Networks. It connects directly to how layers calculate their output size, which uses stride and padding in its formula. It also relates to how much of the original image a later layer can 'see', a property called the receptive field; if you use a large stride, each step covers more area, changing what the network notices. Finally, it connects to pooling, which is another method for shrinking images by selecting representative values, whereas stride shrinks them by skipping positions entirely.

Signal from the Frontier

Get the next essay on mind, machine, and meaning

Essays at the intersection of AI, philosophy, and Indian governance. No promotional content.

We'll send a one-click sign-in link to confirm. No password needed.

Views expressed are personal and do not represent the Government of India or the Government of Uttarakhand.