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
f32a0a63
Commit
f32a0a63
authored
Jun 12, 2018
by
Carl Case
Browse files
Don't touch gpu tensors in functional API
parent
378ce1e1
Changes
2
Hide 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 @
f32a0a63
...
@@ -49,7 +49,7 @@ def maybe_half(x, name='', verbose=False):
...
@@ -49,7 +49,7 @@ def maybe_half(x, name='', verbose=False):
if
is_nested
(
x
):
if
is_nested
(
x
):
return
type
(
x
)([
maybe_half
(
y
)
for
y
in
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
return
x
else
:
else
:
if
verbose
:
if
verbose
:
...
@@ -60,7 +60,7 @@ def maybe_float(x, name='', verbose=False):
...
@@ -60,7 +60,7 @@ def maybe_float(x, name='', verbose=False):
if
is_nested
(
x
):
if
is_nested
(
x
):
return
type
(
x
)([
maybe_float
(
y
)
for
y
in
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
return
x
else
:
else
:
if
verbose
:
if
verbose
:
...
...
apex/amp/wrap.py
View file @
f32a0a63
...
@@ -70,7 +70,7 @@ def sequence_promote(mod, fn, verbose=False):
...
@@ -70,7 +70,7 @@ def sequence_promote(mod, fn, verbose=False):
seq
,
{})
seq
,
{})
return
orig_fn
(
cast_seq
,
*
args
,
**
kwargs
)
return
orig_fn
(
cast_seq
,
*
args
,
**
kwargs
)
else
:
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?
# Just pass through?
return
orig_fn
(
seq
,
*
args
,
**
kwargs
)
return
orig_fn
(
seq
,
*
args
,
**
kwargs
)
utils
.
set_func
(
mod
,
fn
,
wrapper
)
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