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 <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Sean Naren <[email protected]>
  • Loading branch information
4 people authored Dec 19, 2020
1 parent 5d2fa98 commit 4c34855
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 4c34855

Please sign in to comment.