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
Megatron-LM
Commits
4ee0537a
You need to sign in or sign up before continuing.
Commit
4ee0537a
authored
Jul 04, 2020
by
Devendra Singh Sachan
Browse files
small fix for CheckpointFunction's backward() method when sone args may be NoneType
parent
46a536cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
megatron/mpu/random.py
megatron/mpu/random.py
+3
-1
No files found.
megatron/mpu/random.py
View file @
4ee0537a
...
@@ -234,7 +234,9 @@ class CheckpointFunction(torch.autograd.Function):
...
@@ -234,7 +234,9 @@ class CheckpointFunction(torch.autograd.Function):
if
isinstance
(
outputs
,
torch
.
Tensor
):
if
isinstance
(
outputs
,
torch
.
Tensor
):
outputs
=
(
outputs
,)
outputs
=
(
outputs
,)
torch
.
autograd
.
backward
(
outputs
,
args
)
torch
.
autograd
.
backward
(
outputs
,
args
)
return
(
None
,)
+
tuple
(
inp
.
grad
for
inp
in
detached_inputs
)
grads
=
tuple
(
inp
.
grad
if
isinstance
(
inp
,
torch
.
Tensor
)
else
inp
for
inp
in
detached_inputs
)
return
(
None
,)
+
grads
def
checkpoint
(
function
,
*
args
):
def
checkpoint
(
function
,
*
args
):
...
...
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