Skip to content
RED SAGSkills
medium10 pts · first answer countspytorchtraining

Training loop without zero_grad

A teammate wrote this loop and the loss soon becomes unstable. What is going on?

for xb, yb in loader:
    loss = loss_fn(model(xb), yb)
    loss.backward()
    optimizer.step()
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions