LESSON 6.04 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
The PyTorch training step
Watch one training step clear, fill and use the gradients, then resume from a checkpoint.
Needs6.03 Autograd
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 6.04 · TRAINING BAYSTEP 3 OF 30 · ADAM · 3 PARAMS, 3 BUFFERS
01
Stage 1 of 6 · The modules
nn.Linear holds weight (w₁, w₂) and bias b; the norm module holds 3 buffers. The Adam optimizer keeps m, v and a step count.
Explain it simply
You see the two modules of a tiny PyTorch program. The model box holds three weights that training changes. The norm box holds a running mean and variance: saved numbers that no gradient changes. The optimizer box below keeps its own notes about each weight.
Before step 3: weights w1 −0.39, w2 −0.53, bias b 0.21. The norm module keeps a mean, a variance and a count of 8. The optimizer is Adam.
x, x̂, y, buffersparametersgrads, loss, optimizer stateŷNone, not saved
Toy: 8 examples, nn.Linear(2, 1), 30 steps
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
nn.Linear weights each scaled input and adds the bias b.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.