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
Fairseq
Commits
0b84ab19
Commit
0b84ab19
authored
Jan 09, 2018
by
Myle Ott
Browse files
Fix training
parent
5eddda8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
fairseq/utils.py
fairseq/utils.py
+4
-1
No files found.
fairseq/utils.py
View file @
0b84ab19
...
@@ -197,7 +197,10 @@ def make_variable(sample, volatile=False, cuda_device=None):
...
@@ -197,7 +197,10 @@ def make_variable(sample, volatile=False, cuda_device=None):
if
torch
.
is_tensor
(
maybe_tensor
):
if
torch
.
is_tensor
(
maybe_tensor
):
if
cuda_device
is
not
None
and
torch
.
cuda
.
is_available
():
if
cuda_device
is
not
None
and
torch
.
cuda
.
is_available
():
maybe_tensor
=
maybe_tensor
.
cuda
(
async
=
True
,
device
=
cuda_device
)
maybe_tensor
=
maybe_tensor
.
cuda
(
async
=
True
,
device
=
cuda_device
)
return
volatile_variable
(
maybe_tensor
)
if
volatile
:
return
volatile_variable
(
maybe_tensor
)
else
:
return
Variable
(
maybe_tensor
)
elif
isinstance
(
maybe_tensor
,
dict
):
elif
isinstance
(
maybe_tensor
,
dict
):
return
{
return
{
key
:
_make_variable
(
value
)
key
:
_make_variable
(
value
)
...
...
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