difficulty 3/5
Convolution
Sliding a small learned kernel across an input and taking a weighted sum at each position — the same weights everywhere, which is how a layer can look at an image without a parameter per pixel.
Intuition
A fully connected layer treats an image as a bag of pixels: every input wired to every output, and no notion that two neighbouring pixels have anything to do with each other. You could shuffle the pixels before training and it would learn just as well, which tells you it was never using the structure [1, ch. 7, introduction].
Convolution starts from two things you already know about images. A cat is a cat wherever it appears in the frame. And whether a pixel is part of an edge depends on its neighbours, not on something in the far corner.
Encode those two facts and the layer changes shape entirely: one small set of weights, applied identically at every position. It is less a different algorithm than a fully connected layer with most of its freedom taken away — and the freedom removed was freedom to learn things that are not true of images.
Formal definition
How it works
Where it's used
Why & when
Worked example
Pitfalls
Check yourself
3 questions
The questions on this page come with access. They are graded on the server, so the answers stay there until you have given yours.
Sources
- Dive into Deep Learningbook · retrieved 2026-09-05https://d2l.ai/
- PyTorch documentation — torch.nn.Conv2ddocs · retrieved 2026-09-05https://docs.pytorch.org/docs/stable/generated/torch.nn.Conv2d.html