From 0858beaf6b7b91473315287332cb7c0cf2cf9468 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 23 Dec 2020 19:16:45 +0100 Subject: [PATCH] [bugfix] Group defaults to WORLD if None (#5125) * [bugfix] Group defaults to WORLD if None * fix no_grad * Update pytorch_lightning/utilities/distributed.py * Update pytorch_lightning/utilities/distributed.py Co-authored-by: Gregor Koporec Co-authored-by: Jirka Borovec Co-authored-by: Rohit Gupta Co-authored-by: Sean Naren (cherry picked from commit 176735097ab5be9ee21d3e7a3dedc174f3e0dd3f) --- pytorch_lightning/utilities/distributed.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pytorch_lightning/utilities/distributed.py b/pytorch_lightning/utilities/distributed.py index be5d781939..2a0b989e9b 100644 --- a/pytorch_lightning/utilities/distributed.py +++ b/pytorch_lightning/utilities/distributed.py @@ -202,6 +202,7 @@ def all_gather_ddp_if_available( Return: A tensor of shape (world_size, batch, ...) """ + group = group if group is not None else torch.distributed.group.WORLD if torch.distributed.is_available() and torch.distributed.is_initialized(): if sync_grads: return AllGatherGrad.apply(tensor, group)