23/31
Part 5 of 6 · A Linear layer, proved by gradcheckLearn and do
gradcheck builds the Jacobian two ways
gradcheck builds the Jacobian, the grid of every output's slope against every input, twice. Then it compares the two with allclose:
| Side | How it builds the Jacobian |
|---|---|
| Numerical | nudge one input entry by ±1e-6 and see how every output moves: one column per input entry |
| Analytical | run your backward with grad_out = 1 at one output entry and 0 elsewhere: one row per output entry |
| Then | compare the two grids with allclose |
The numerical side takes the central difference: the change in the outputs between the two nudges, divided by .
y is (2, 3, 5), a is (2, 3, 4) and b is (4, 5). How big is the Jacobian gradcheck builds?
Pick an answer above to see the rest