Open
Description
Hi, Excellent tutorials! But I have a question. Form tutorial 13 and on you change the place where the zero_grad
method is called and I do not get why?
Before 13 was:
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
optimizer.zero_grad()
After 13:
loss = criterion(outputs, labels)
optimizer.zero_grad() # Here is the change
loss.backward()
optimizer.step()
Now I am wondering if you set to zero the gradients, then, how the optimizer could update the parameters without any information about the gradient?
Metadata
Metadata
Assignees
Labels
No labels