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
f06feced
Commit
f06feced
authored
Dec 10, 2018
by
Deyu Fu
Browse files
better print
parent
c8ca4bf4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
apex/optimizers/fp16_optimizer.py
apex/optimizers/fp16_optimizer.py
+2
-3
No files found.
apex/optimizers/fp16_optimizer.py
View file @
f06feced
...
@@ -182,7 +182,7 @@ class FP16_Optimizer(object):
...
@@ -182,7 +182,7 @@ class FP16_Optimizer(object):
def
_update_scale
(
self
,
skip
):
def
_update_scale
(
self
,
skip
):
if
self
.
dynamic_loss_scale
:
if
self
.
dynamic_loss_scale
:
if
skip
:
if
skip
:
print
(
"
g
rad overflow on iteration"
,
self
.
cur_iter
)
print
(
"
\n
G
rad overflow on iteration"
,
self
.
cur_iter
)
print
(
"Using dynamic loss scale of"
,
self
.
cur_scale
)
print
(
"Using dynamic loss scale of"
,
self
.
cur_scale
)
self
.
cur_scale
=
max
(
self
.
cur_scale
/
self
.
scale_factor
,
1
)
self
.
cur_scale
=
max
(
self
.
cur_scale
/
self
.
scale_factor
,
1
)
self
.
last_overflow_iter
=
self
.
cur_iter
self
.
last_overflow_iter
=
self
.
cur_iter
...
@@ -191,7 +191,7 @@ class FP16_Optimizer(object):
...
@@ -191,7 +191,7 @@ class FP16_Optimizer(object):
self
.
cur_scale
*=
self
.
scale_factor
self
.
cur_scale
*=
self
.
scale_factor
else
:
else
:
if
skip
:
if
skip
:
print
(
"Grad overflow on iteration"
,
self
.
cur_iter
)
print
(
"
\n
Grad overflow on iteration"
,
self
.
cur_iter
)
print
(
"Using static loss scale of"
,
self
.
cur_scale
)
print
(
"Using static loss scale of"
,
self
.
cur_scale
)
self
.
cur_iter
+=
1
self
.
cur_iter
+=
1
return
return
...
@@ -214,4 +214,3 @@ class FP16_Optimizer(object):
...
@@ -214,4 +214,3 @@ class FP16_Optimizer(object):
self
.
optimizer
.
param_groups
=
value
self
.
optimizer
.
param_groups
=
value
param_groups
=
property
(
_get_param_groups
,
_set_param_groups
)
param_groups
=
property
(
_get_param_groups
,
_set_param_groups
)
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