Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
fix optimizer zero_grad
Browse files Browse the repository at this point in the history
  • Loading branch information
ifndef012 committed Jul 18, 2020
1 parent c9b9b32 commit ce535fc
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def train(self, train_loader):
sample, target = batch
output = self.model(sample)
loss = self.loss(output, target)
loss.backward()
self.optimizer.zero_grad()
loss.backward()
self.optimizer.step()

def evaluate(self):
Expand Down

0 comments on commit ce535fc

Please sign in to comment.