Created
July 29, 2019 17:49
-
-
Save williamFalcon/012def1be85abd79d9fdfb9fdd34c8dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable 16-bit on the model and the optimizer | |
model, optimizers = amp.initialize(model, optimizers, opt_level='O2') | |
# when doing .backward, let amp do it so it can scale the loss | |
with amp.scale_loss(loss, optimizer) as scaled_loss: | |
scaled_loss.backward() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment