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
78a6ef02
Commit
78a6ef02
authored
Feb 23, 2018
by
Myle Ott
Committed by
Sergey Edunov
Feb 27, 2018
Browse files
pytorch update: no need to rewrap variable in backward()
parent
866b27d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
fairseq/criterions/label_smoothed_cross_entropy.py
fairseq/criterions/label_smoothed_cross_entropy.py
+4
-1
No files found.
fairseq/criterions/label_smoothed_cross_entropy.py
View file @
78a6ef02
...
...
@@ -41,7 +41,10 @@ class LabelSmoothedNLLLoss(torch.autograd.Function):
@
staticmethod
def
backward
(
ctx
,
grad
):
return
utils
.
volatile_variable
(
ctx
.
grad_input
)
*
grad
,
None
,
None
,
None
,
None
,
None
grad_input
=
ctx
.
grad_input
if
not
isinstance
(
grad_input
,
torch
.
autograd
.
Variable
):
grad_input
=
utils
.
volatile_variable
(
grad_input
)
return
grad_input
*
grad
,
None
,
None
,
None
,
None
,
None
@
register_criterion
(
'label_smoothed_cross_entropy'
)
...
...
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