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()Discussion 0
Join free to post in the discussion.
Related questions
- Dropout after eval()Machine Learning Engineer
- When early stopping triggersMachine Learning Engineer
- Optimizer steps in one epochMachine Learning Engineer
- Different results every inference runMachine Learning Engineer
- Gradient of a sum of squaresMachine Learning Engineer
- Softmax before CrossEntropyLossMachine Learning Engineer
- Shape after a batched matmulMachine Learning Engineer
- Why use learning rate warmupMachine Learning Engineer