Skip to content

Commit

Permalink
Perform zero_grad after each batch (PythonOT#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachayev authored May 2, 2023
1 parent 42a62c1 commit 8a7035b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions examples/backends/plot_wass2_gan_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def forward(self, x):

loss.backward()
optimizer.step()
optimizer.zero_grad()

del M

Expand Down

0 comments on commit 8a7035b

Please sign in to comment.