Skip to content

Commit

Permalink
To resolve version fails from PR #2715 (all_gather with group) (#2729)
Browse files Browse the repository at this point in the history
  • Loading branch information
puhuk authored Oct 2, 2022
1 parent a3279a6 commit 0f01fb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ignite/distributed/comp_models/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ def _do_all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None) -> t
if tensor.ndimension() == 0:
tensor = tensor.unsqueeze(0)
output = [torch.zeros_like(tensor) for _ in range(self.get_world_size())]
dist.all_gather(output, tensor, group=group)
if group is not None:
dist.all_gather(output, tensor, group=group)
else:
dist.all_gather(output, tensor)
return torch.cat(output, dim=0)

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

0 comments on commit 0f01fb4

Please sign in to comment.