code: def _simple_gather_all_tensors(
      result: Tensor, group: Any, world_size: int
  ) -> List[Tensor]:
      gathered_result = [
          torch.zeros_like(result) for _ in range(world_size)
      ]
      torch.distributed.all_gather(gathered_result, result, group)
      return gathered_result
  
file_path: torchmetrics/src/torchmetrics/utilities/distributed.py
imports: from typing import Any, List, Optional
  import torch
  from torch import Tensor
  from torch.nn import functional
  from typing_extensions import Literal
label_desc: Use image node_id 3 for calling a global function with example usage: _simple_gather_all_tensors(result, group, world_size) and returns: gathered_result