Before you can read a single line of the parent note the Autograd note, you need a small toolbox of ideas. This page builds each one from nothing. Nothing here is assumed. If a symbol appears, it was defined a line earlier and pinned to a picture.
Normally a number is just a value: 3.0. It sits there. It has no history.
The whole trick of autograd is to use a number that carries a history — it remembers where it came from and what was done to it. In PyTorch that "number-with-history" is a tensor (a container for one or more numbers) that you flag with requires_grad=True.
Look at the picture. A plain number (left) is a lone dot — no arrows in, no arrows out. A tracked tensor (right) has an arrow pointing back to whatever operation produced it. That backward-pointing arrow is the seed of the whole computational graph.
Before derivatives we need the language of changing quantities.
The picture for a function is an input arrow → box → output arrow. This is exactly the node picture from Section 0 — a function is an operation, and its output is a new tracked number. This is why the topic calls the whole thing a graph of operations.
The parent note writes z = x * y + x**2. Reading the left side with Section 1: z is the output of feeding inputs x and y through three operations:
x×y — multiply (in code: x * y)
x2 — square, meaning x×x (in code: x**2)
+ — add
So in symbols the output is z=xy+x2.
Each operation is a little machine (a function of Section 1). So z=xy+x2 is really three machines feeding into each other, and z is the final number that drops out the end.
This is the single most important tool the topic uses, so we build it slowly.
Why do we need a rate and not just the output value? Because training a network means adjusting inputs (the weights) to lower a loss. To adjust wisely you must know which direction lowers the loss and by how much per step. That is precisely a derivative.
Look at the curve f(x)=x2 in the figure. Pick the point at x=2. Draw a tiny step of width h to the right (the pale-yellow segment). The output climbs by the pink segment. The slope of the straight line connecting the two points is runrise=hf(x+h)−f(x). As h shrinks toward zero, that line becomes the blue tangent — the true instantaneous rate. That limiting slope is the derivative.
Let us earn the parent note's result dxdx2=2x by hand:
dxdx2=limh→0h(x+h)2−x2=limh→0hx2+2xh+h2−x2=limh→0h2xh+h2=limh→0(2x+h)=2x
What we did: expanded (x+h)2, cancelled x2, cancelled one h top-and-bottom, then let h→0 so the leftover h vanished. Why: this is the only honest definition of "instantaneous rate," and it is exactly the rule autograd applies internally for every squaring operation.
Section 2 said operations feed into each other. Suppose the output is built in two stages: an inner machine g turns x into an in-between value we also call g, then an outer machine f turns that into the final output z. In symbols z=f(g(x)), where g names both the inner machine and the number it produces. How does a nudge in x reach z?
Why the topic lives on this: the backward pass is nothing but the chain rule applied step by step through the graph, multiplying the little rate stored at each node.
When x reaches z by two different paths (in z=xy+x2, the value x flows into both the xy node and the x2 node), the two ripples add:
∂x∂z=via xyy+via x22x
The parent's Example 1 uses y=Wx+b. Heads-up on naming: here y is the output of the layer — it plays the role z played in Sections 2–5. We keep the parent's letter y, but remember y is now "the number the machine produces," not an input. Unpack the rest of the alphabet:
Now the weight gradient. Let ∂y∂L be the row of rates of the loss with respect to the layer's outputy (Section 8 defines L). Since y=Wx+b, matrix calculus gives
∂W∂L=xT∂y∂L.Shape check:xT is 2×1 and ∂y∂L is 1×2, so their product is 2×2 — exactly the shape of W. That shape agreement is how you know the formula is put together correctly. (The parent note wrote this with z for the pre-activation output; it is the same output-role letter, just renamed.)
You will meet these live when you build layers: 3.4.01-Building-neural-networks-with-torch.nn.Module.
Now the code words in the parent are just labels on the ideas above:
Symbol / word
Plain meaning
Which idea it is
requires_grad=True
"track this number's history"
the remembering tensor (§0)
grad_fn
"the operation that made me"
the backward arrow / node (§0, §2)
.backward()
"run the chain rule backwards now"
§5 + §6
.grad
"here is ∂L/∂(me)"
a partial derivative (§4)
.zero_()
"wipe the accumulated sum"
reset the raw .grad sum (§8)
These reappear the moment you touch 4.2.03-Batch-normalization, 5.3.01-Transfer-learning, and memory tricks like 6.4.02-Gradient-checkpointing — so lock them in.
The picture below shows how each foundation feeds the next, ending at the autograd machinery.
Read it top-to-bottom: raw tensors and functions become graph nodes; derivatives and the chain rule power the backward walk; vectors and matrices supply the layer shapes; a scalar loss seeds the whole thing — and all of it lands in Autograd in PyTorch.