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

The ReLU mask

The mask comes from pre, never from h

You've used the ReLU gate once already. One detail of it decides whether your gradients come out right.

pre = np.array([1.5, -0.5, 2.0, -3.0])
h = np.maximum(pre, 0)
dh = np.array([0.1, 0.2, 0.3, 0.4])
print(h)
print(dh * (pre > 0))
print(dh * (h >= 0))
Predict

pre is [1.5, -0.5, 2.0, -3.0] and dh is [0.1, 0.2, 0.3, 0.4]. What is dh * (pre > 0)?

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