Understanding PyTorch Autograd by Writing a Custom Training Loop
You have been calling loss.backward() without knowing what it does, and that is why gradient bugs feel like magic. This walkthrough opens up autograd with real printed output, so the rules stop being things you memorise and start being things you can reason about.
