We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
CNNs from Scratch
PyTorchBuild convolutional networks one block at a time — from raw conv to skip connections and squeeze-excitation.
15 exercises
Explore freely. Sign in to keep your progress.
Your learning sequence
- 1 Not solved yet. Implement 1D Convolution Practice · Hard
- 2 Not solved yet. Implement Conv2d Practice · Medium
- 3 Not solved yet. Implement Max Pooling 1D Practice · Medium
- 4 Not solved yet. Implement Average Pooling 1D Practice · Medium
- 5 Not solved yet. Depthwise Separable Convolution Practice · Hard
- 6 Not solved yet. Transposed Conv2d Practice · Hard
- 7 Not solved yet. Skip Connection Block Practice · Medium
- 8 Not solved yet. Squeeze-and-Excitation Block Practice · Medium
- 9 Not solved yet. Simple CNN Practice · Medium
- 10 Not solved yet. Train Image Classifier End-to-End Practice · Medium
- 11 Not solved yet. Patch Embedding with CLS Token Practice · Medium
- 12 Not solved yet. ViT Encoder Block Practice · Medium
- 13 Not solved yet. ViT Classification Forward Practice · Hard
- 14 Not solved yet. Train ViT Classifier End-to-End Practice · Hard
- 15 Not solved yet. ViT with Mixup Augmentation Practice · Medium
Check yourself
4 questions · not saved while you're signed outUse these questions to check your understanding and compare explanations. Your score does not affect track completion.
For a 32 by 32 input and a 3 by 3 kernel with dilation 1, what are the output spatial sizes for the two convolutions below?
Choose one answer to reveal the explanations. Answers are kept only while this page is open.
import torch
from torch import nn
x = torch.zeros(1, 1, 32, 32)
for stride, padding in [(1, 0), (2, 1)]:
conv = nn.Conv2d(1, 1, 3, stride=stride, padding=padding)
print(tuple(conv(x).shape[-2:]))