VFlash: Fast, Accurate Visual Planning via Flash Primitive Decoding
u_Unrolled
Easy10 XPPyTorchbugs

What happens if you forget optimizer.zero_grad()?

A training loop calls loss.backward() and optimizer.step() but never optimizer.zero_grad(). What happens?

Stuck? Show the solution

Answer: B. Gradients accumulate across steps, so updates grow and training becomes unstable

.grad is summed into on every backward pass. Without zeroing, each step uses the sum of all previous gradients.

Learn the idea behind itPyTorch Engineering — From Tensors to Fast, Correct Training Loops