Skip to content

Commit f6e074a

Browse files
author
Svetlana Karslioglu
authored
Update autogradyt_tutorial.py (#2247)
Fix #2219
1 parent ccb38b4 commit f6e074a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/introyt/autogradyt_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def forward(self, x):
334334

335335
print(model.layer2.weight.grad[0][0:10])
336336

337-
optimizer.zero_grad()
337+
optimizer.zero_grad(set_to_none=False)
338338

339339
print(model.layer2.weight.grad[0][0:10])
340340

0 commit comments

Comments
 (0)