PyTorch
Tensors, autograd and neural networks in Python.
PyTorch is taught here in 12 lessons, running from Tensors and autograd through to Exporting and deploying models. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | AI & Intelligent Development |
| Lessons | 12 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: TensorFlow |
Lessons
- Tensors and autogradThe core data structure, moving work to the GPU, and the automatic differentiation that makes training possible.
- The training loopA complete, correct training and evaluation loop — loss, optimiser, batching, and validation that you can trust.
- Modules, data and savingWriting models as nn.Module, feeding data with Dataset/DataLoader, and persisting weights correctly.
- Building networks: layers, containers and initialisationSequential, ModuleList and ModuleDict, wiring branches and shared layers, and why default initialisation is not always what you want.
- Loss functions and optimisers in practiceCrossEntropyLoss and its logits expectation, BCEWithLogitsLoss, MSE variants, and SGD versus Adam versus AdamW with correct weight decay.
- Data pipelines and augmentation with torchvisionTransforms and Compose, custom Datasets, weighted samplers for imbalanced classes, collate functions, and worker settings that do not stall.
- Transfer learning and fine-tuningTorchvision and Hugging Face backbones, freezing parameters correctly, replacing heads, discriminative learning rates, and feature extraction as a baseline.
- Learning-rate schedules and regularisationStepLR, cosine annealing, warmup, ReduceLROnPlateau, early stopping, dropout, label smoothing, weight decay and gradient clipping.
- Experiment tracking and reproducibilityTensorBoard integration, logging metrics and sample predictions, seeding, deterministic flags, and comparing runs so the comparison is fair.
- Mixed precision and GPU performanceautocast and GradScaler, channels_last, pinned memory, gradient accumulation, and profiling to find where the frame time actually goes.
- Debugging PyTorch modelsShape mismatches, device and dtype errors, NaN losses, exploding gradients, autograd graph errors, and using hooks to inspect what the layers actually see.
- Exporting and deploying modelsTorchScript and torch.compile, ONNX export, dynamic quantisation, and packaging a model behind an inference API with correct preprocessing.
More in AI & Intelligent Development
AI Basics AI Agents Math for AI Machine Learning scikit-learn TensorFlow Natural Language Processing LangChain Ollama OpenCV Codex Claude Code OpenCode Vibe Coding Selenium Playwright
FAQ
How long does the PyTorch course take?
It has 12 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for PyTorch?
Not strictly. It helps to have read TensorFlow first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after PyTorch?
Continue with Natural Language Processing (12 lessons), the next course in AI & Intelligent Development.