Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
1b8303d8
Commit
1b8303d8
authored
Apr 29, 2019
by
Michael Carilli
Browse files
Adding warning for amp.scale_loss
parent
7b245dba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
apex/amp/handle.py
apex/amp/handle.py
+5
-0
No files found.
apex/amp/handle.py
View file @
1b8303d8
...
...
@@ -75,6 +75,11 @@ def scale_loss(loss,
.. _`Advanced Amp Usage`:
https://nvidia.github.io/apex/advanced.html
"""
if
not
hasattr
(
_amp_state
,
"opt_properties"
):
raise
RuntimeError
(
"Invoked 'with amp.scale_loss`, but internal Amp state has not been initialized. "
"model, optimizer = amp.initialize(model, optimizer, opt_level=...) must be called "
"before `with amp.scale_loss`."
)
if
not
_amp_state
.
opt_properties
.
enabled
:
yield
loss
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment