code: def gather_tensor_along_batch(tensor, dim=0):
      world_size = get_world_size()
  
      if world_size < 2:
          return tensor
  
      with torch.no_grad():
          tensor_list = []
  
          for _ in range(world_size):
              tensor_list.append(torch.zeros_like(tensor))
  
          dist.all_gather(tensor_list, tensor)
          tensor_list = torch.cat(tensor_list, dim=dim)
      return tensor_list
  
imports: import contextlib
  import logging
  import os
  import pickle
  import socket
  import subprocess
  import warnings
  from itertools import chain
  import torch
  from mmf.common.registry import registry
  from torch import distributed
label_desc: Use image node_id 12 for calling a global function with example usage: gather_tensor_along_batch(tensor, dim) and returns: tensor_list, tensor