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
b1dfd39e
"vscode:/vscode.git/clone" did not exist on "5a65066922ce28dbc202dc03bb2410da14b980d2"
Commit
b1dfd39e
authored
Nov 07, 2017
by
Myle Ott
Browse files
Revert `dim` in `F.softmax` for backwards compatibility
parent
42a0150c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
fairseq/models/fconv.py
fairseq/models/fconv.py
+1
-1
fairseq/sequence_generator.py
fairseq/sequence_generator.py
+1
-1
No files found.
fairseq/models/fconv.py
View file @
b1dfd39e
...
...
@@ -128,7 +128,7 @@ class AttentionLayer(nn.Module):
# softmax over last dim
sz
=
x
.
size
()
x
=
F
.
softmax
(
x
.
view
(
sz
[
0
]
*
sz
[
1
],
sz
[
2
])
,
dim
=
1
)
x
=
F
.
softmax
(
x
.
view
(
sz
[
0
]
*
sz
[
1
],
sz
[
2
]))
x
=
x
.
view
(
sz
)
attn_scores
=
x
...
...
fairseq/sequence_generator.py
View file @
b1dfd39e
...
...
@@ -330,7 +330,7 @@ class SequenceGenerator(object):
decoder_out
,
attn
=
model
.
decoder
.
incremental_forward
(
tokens
,
encoder_out
)
else
:
decoder_out
,
attn
=
model
.
decoder
.
forward
(
tokens
,
encoder_out
)
probs
=
F
.
softmax
(
decoder_out
[:,
-
1
,
:]
,
dim
=
1
).
data
probs
=
F
.
softmax
(
decoder_out
[:,
-
1
,
:]).
data
attn
=
attn
[:,
-
1
,
:].
data
if
avg_probs
is
None
or
avg_attn
is
None
:
avg_probs
=
probs
...
...
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