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
2a681d99
Commit
2a681d99
authored
Apr 25, 2018
by
Alexei Baevski
Committed by
Myle Ott
Jun 15, 2018
Browse files
make sure tensor used to index is cuda if on gpu
parent
88df72c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
fairseq/sequence_generator.py
fairseq/sequence_generator.py
+1
-1
No files found.
fairseq/sequence_generator.py
View file @
2a681d99
...
@@ -380,7 +380,7 @@ class SequenceGenerator(object):
...
@@ -380,7 +380,7 @@ class SequenceGenerator(object):
new_bsz
=
bsz
-
len
(
finalized_sents
)
new_bsz
=
bsz
-
len
(
finalized_sents
)
batch_mask
=
torch
.
ones
(
bsz
).
type_as
(
cand_indices
)
batch_mask
=
torch
.
ones
(
bsz
).
type_as
(
cand_indices
)
batch_mask
[
torch
.
LongTensor
(
finalized_sents
)]
=
0
batch_mask
[
cand_indices
.
new
(
finalized_sents
)]
=
0
batch_idxs
=
batch_mask
.
nonzero
().
squeeze
(
-
1
)
batch_idxs
=
batch_mask
.
nonzero
().
squeeze
(
-
1
)
eos_mask
=
eos_mask
[
batch_idxs
]
eos_mask
=
eos_mask
[
batch_idxs
]
...
...
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