Skip to content

Commit

Permalink
[bugfix] Correct call to torch.no_grad (#5124)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
  • Loading branch information
4 people committed Dec 23, 2020
1 parent 37f5197 commit 28c3cc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytorch_lightning/utilities/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ def all_gather_ddp_if_available(
if sync_grads:
return AllGatherGrad.apply(tensor, group)
else:
with torch.no_grad:
with torch.no_grad():
return AllGatherGrad.apply(tensor, group)
return tensor

0 comments on commit 28c3cc3

Please sign in to comment.