Map 1 · Building and training a network · Step 7

Update the weights

How do I turn gradients into a better network?

Key formula

on mini-batches; momentum or Adam in practice.

Fact or figure

An oscillating or exploding loss means is too large; a crawling one, too small. Search it on a log scale.

Skip this step and…

Forgetting optimizer.zero_grad() sums old gradients into every step.

Digits example

Mini-batches of 64 images: about 940 updates per epoch on 60,000 training images.

Learn it

Taught in Section 1 (Foundations of Deep Learning), Section 7 (Backpropagation), Section 8 (Generalisation and Data) and Section 11 (Network Design and PyTorch) of the course. The map follows the deep learning workflow, the order you build a model in; the course teaches in the order that is easiest to learn, so the numbers can jump.

How it connects

← Back to the whole map