18/32
Part 4 of 6 · The ReLU mask, and a worked exampleLearn and do

The backward pass: the mask stops the blame

Now run the backward pass on the same numbers.

dlogits = np.exp(log_probs)
dlogits[np.arange(2), y] -= 1
dlogits /= 2
dh = dlogits @ W2.T
dpre = dh * (pre > 0)
print(dpre.round(2))
print((x.T @ dpre).round(2))
Predict

Example 2's second hidden unit had pre = -1. What does dpre hold there?

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