code: def _gather_along_first_dim(input_):
      """Gather tensors and concatinate along the first dimension."""
  
      world_size = get_tensor_model_parallel_world_size()
      # Bypass the function if we are using only 1 GPU.
      if world_size == 1:
          return input_
  
      dim_size = list(input_.size())
      dim_size[0] = dim_size[0] * world_size
  
      output = torch.empty(
          dim_size,
          dtype=input_.dtype,
          device=torch.cuda.current_device(),
      )
      torch.distributed._all_gather_base(
          output,
          input_.contiguous(),
          group=get_tensor_model_parallel_group(),
      )
  
      return output
  
imports: import torch
  from megatron.core.parallel_state import get_tensor_and_expert_parallel_group, get_tensor_model_parallel_group, get_tensor_model_parallel_rank, get_tensor_model_parallel_world_size
  from .utils import split_tensor_along_last_dim
label_desc: Use image node_id 5 for calling a global function with example usage: _gather_along_first_dim(input_) and returns: output, input_