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
227a9a2d
Unverified
Commit
227a9a2d
authored
Jun 12, 2018
by
Carl Case
Committed by
GitHub
Jun 12, 2018
Browse files
Merge pull request #10 from NVIDIA/amp_cpu_fix
amp shouldn't convert CPU tensors
parents
378ce1e1
f32a0a63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
apex/amp/utils.py
apex/amp/utils.py
+2
-2
apex/amp/wrap.py
apex/amp/wrap.py
+1
-1
No files found.
apex/amp/utils.py
View file @
227a9a2d
...
...
@@ -49,7 +49,7 @@ def maybe_half(x, name='', verbose=False):
if
is_nested
(
x
):
return
type
(
x
)([
maybe_half
(
y
)
for
y
in
x
])
if
type_string
(
x
)
==
'HalfTensor'
:
if
not
x
.
is_cuda
or
type_string
(
x
)
==
'HalfTensor'
:
return
x
else
:
if
verbose
:
...
...
@@ -60,7 +60,7 @@ def maybe_float(x, name='', verbose=False):
if
is_nested
(
x
):
return
type
(
x
)([
maybe_float
(
y
)
for
y
in
x
])
if
type_string
(
x
)
==
'FloatTensor'
:
if
not
x
.
is_cuda
or
type_string
(
x
)
==
'FloatTensor'
:
return
x
else
:
if
verbose
:
...
...
apex/amp/wrap.py
View file @
227a9a2d
...
...
@@ -70,7 +70,7 @@ def sequence_promote(mod, fn, verbose=False):
seq
,
{})
return
orig_fn
(
cast_seq
,
*
args
,
**
kwargs
)
else
:
# TODO: other mixed-type cases aren't due to a
utohalf
.
# TODO: other mixed-type cases aren't due to a
mp
.
# Just pass through?
return
orig_fn
(
seq
,
*
args
,
**
kwargs
)
utils
.
set_func
(
mod
,
fn
,
wrapper
)
...
...
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