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
2063287b
Commit
2063287b
authored
Jul 25, 2018
by
Michael Carilli
Browse files
Using temporary Python-side inf+nan check in amp/scaler.py
parent
ae921de2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
apex/amp/scaler.py
apex/amp/scaler.py
+3
-2
No files found.
apex/amp/scaler.py
View file @
2063287b
...
...
@@ -16,7 +16,7 @@ def scale_check_overflow(d_grads, scale):
return
True
d_grads
.
mul_
(
scale
)
return
False
class
LossScaler
(
object
):
def
__init__
(
self
):
self
.
_loss_scale
=
2.
**
16
...
...
@@ -36,7 +36,8 @@ class LossScaler(object):
if
p
.
grad
is
not
None
:
self
.
_has_overflow
=
scale_check_overflow
(
p
.
grad
.
data
,
1.
/
scale
)
if
self
.
_has_overflow
:
break
if
self
.
_has_overflow
:
break
# if self._overflow_buf.any():
if
self
.
_has_overflow
:
...
...
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