Module 5 of 12

PyTorch Essentials

Lessons

About This Module

PyTorch is the most widely used framework for deep learning, and it turns everything so far into code. Data lives in tensors, arrays that can run on a GPU. Autograd records the operations on them and computes the gradients for you, so backpropagation becomes a single backward() call.

Models are built as modules, classes that hold layers and define the forward pass. Datasets and data loaders feed the data in shuffled batches. Every training script then repeats the same four steps: forward pass, loss, backward pass, optimizer update, with a separate evaluation loop that checks performance on data the model has not trained on.

Watch the lessons in order, and run the code yourself where you can. Then continue to Convolutional Neural Networks.

Lessons

3 videos
01

PyTorch in 100 Seconds

Fireship's very short tour of what PyTorch is and why it is so widely used for deep learning, as a quick orientation before the longer tutorials.

Video 2min
02

PyTorch Crash Course

AssemblyAI walks through the whole framework in about 50 minutes: tensors, autograd, a training loop, a neural network and a CNN. The video dates from 2022, so a few calls it uses (such as transforms.ToTensor) have since been deprecated.

Video 49min
03

PyTorch Tutorial 09 - Dataset and DataLoader - Batch Training

Patrick Loeber shows how to feed data to a model: writing a Dataset, wrapping it in a DataLoader, and training in shuffled batches.

Video 15min