Skip to content

Commit ca56200

Browse files
committed
To resolve version fails from PR pytorch#2715 (all_gather with group)
1 parent a3279a6 commit ca56200

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ignite/distributed/comp_models/native.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ def _do_all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None) -> t
437437
if tensor.ndimension() == 0:
438438
tensor = tensor.unsqueeze(0)
439439
output = [torch.zeros_like(tensor) for _ in range(self.get_world_size())]
440-
dist.all_gather(output, tensor, group=group)
440+
if group is not None:
441+
dist.all_gather(output, tensor, group=group)
442+
else:
443+
dist.all_gather(output, tensor)
441444
return torch.cat(output, dim=0)
442445

443446
def _do_new_group(self, ranks: List[int], **kwargs: Any) -> Any:

0 commit comments

Comments
 (0)