Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e87b579

Browse files
f0kmcarilli
authored andcommitted
Include loss scaling in README code example (#523)
1 parent 1904e48 commit e87b579

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ model, optimizer = amp.initialize(model, optimizer, opt_level=opt_level)
6767

6868
# Train your model
6969
...
70+
with amp.scale_loss(loss, optimizer) as scaled_loss:
71+
scaled_loss.backward()
72+
...
7073

7174
# Save checkpoint
7275
checkpoint = {

0 commit comments

Comments
 (0)