← the late compiler
C_000087 · deep learning · intermediate

Convolution Arithmetic

The relationship between input size, kernel size, stride, padding and dilation that determines an output's spatial dimensions.

Step 1 of 4

In words

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

Why am I learning this?

This is the arithmetic that decides the shape of every image in a neural network that looks at pictures. Master it and you can read any architecture diagram, debug the most common error in vision models, and understand why a network's layers shrink or stay the same. It unlocks the next steps: Convolutional Layers, Stride and Padding, Receptive Fields, and Pooling as a Statistic — and from there, whole systems like face recognition, medical imaging, and the vision parts of multimodal AI.

The idea, in plain terms

Imagine a photograph. A convolutional network doesn't look at the whole photo at once; it slides a small window across it, looking at one patch at a time. That window is the kernel. The size of the output depends on three decisions: how big the window is, how far it jumps between patches, and whether we add extra border values so the window can reach the edges. Convolution arithmetic is just tracking this sliding process: start at the top-left, place the window, record the position, move by the stride, repeat until you run out of space. The output's height and width are simply how many times you managed to place the window. Padding lets you start off the edge by adding blank space around the picture, so the window can cover the corners. Dilation stretches the window, skipping pixels inside it, so it sees a wider area without growing in size. All of this is arithmetic: multiply, add, subtract, divide — nothing more.

An analogy

Think of a concierge at a hotel with a long row of rooms on one floor. The concierge walks along the corridor, checking each room for a 'Do Not Disturb' sign. The window is how many rooms he can see at once — say, three. The stride is how many steps he takes between checks — say, two. Padding is putting dummy 'empty' rooms at the ends of the corridor so he can check the very first and last real rooms properly. Dilation is a trick: he skips a room inside his view, so he effectively sees a wider spread without physically looking at more rooms. The number of checks he makes is the output size. Convolution arithmetic is just counting how many checks fit along that corridor. The analogy breaks down because in a real photo the window moves in two dimensions (height and width), but the counting is the same in each direction. Also, the concierge's checks are quick and simple — each check in a convolution multiplies and adds numbers, but that's the next step, not this one. Here, we only care about counting.

Definition

Convolution arithmetic is the set of rules that determine the height and width of a feature map after a convolutional layer, given the input size, kernel size, stride, padding, and dilation.

Where this sits

You haven't studied other topics yet, so this stands on its own. But note: convolution arithmetic is the foundation for the Convolutional Layers that use these numbers to actually compute outputs, and it directly sets how Receptive Fields grow as you stack layers. A network's architecture diagram is full of 'input 32x32, kernel 3x3, stride 1, padding same → output 32x32' — you will be able to read those lines fluently.

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.