Skip to content

Commit 8a7035b

Browse files
authored
Perform zero_grad after each batch (#466)
1 parent 42a62c1 commit 8a7035b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

examples/backends/plot_wass2_gan_torch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def forward(self, x):
151151

152152
loss.backward()
153153
optimizer.step()
154+
optimizer.zero_grad()
154155

155156
del M
156157

0 commit comments

Comments
 (0)