promptdojo_

Mission: tensor playground — step 5 of 7

This relu gets the FORWARD pass right but its backward passes the gradient through unconditionally — so a neuron that output zero still reports a live gradient, and the numeric referee catches the lie: autograd says 1.0 where the true slope at w=-2 is 0.0. Fix the grad_fn to gate the gradient exactly like the forward gates the value.

The break is on line 25 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.