4/31
Part 1 of 6 · Derive the two gradientsLearn and do

dY is how the loss moves with each entry of Y

Some loss LL sits after YY. Write dYdY for ∂L/∂Y\partial L / \partial Y: for each entry of YY, how fast the loss moves when that entry moves. It's one number per entry, so it has YY's shape.

Backward is handed dYdY, as grad_out, and has to produce dAdA and dBdB: one number per entry of AA and of BB.

One entry of A reaches one row of Y

Nudge one entry of A and watch what moves:

A2 = A.clone()
A2[1, 0] += 0.001
print(A2 @ B - Y)
Predict

Nudge A[1, 0] up by 0.001. Which entries of Y move?

Pick one to see what it prints.
Pick an answer above to see the rest