class_docstr: A naive implementation which shard each tensor evenly over all ranks
code: def _gather_tensor(
      self,
      t: ShardedTensor,
      process_group: Optional[dist.ProcessGroup] = None,
  ):
      if not t.is_sharded:
          return
      target_device = t.device
      payload_numel = t.payload.numel()
      world_size = dist.get_world_size(process_group)
      rank = dist.get_rank(process_group)
  
      buffer = torch.empty(
          payload_numel * world_size,
          dtype=t.payload.dtype,
          device=get_current_device(),
      )
      buffer_list = list(torch.chunk(buffer, chunks=world_size, dim=0))
      buffer_list[rank].copy_(t.payload)
  
      dist.all_gather(
          buffer_list,
          buffer_list[rank],
          group=process_group,
          async_op=False,
      )
      gathered_payload = torch.narrow(
          buffer, 0, 0, t.origin_numel
      ).reshape(t.origin_shape)
      t.payload_reset(gathered_payload)
      colo_model_data_tensor_move_inline(t, target_device)
      t.is_sharded = False
  
file_path: colossalai/colossalai/legacy/zero/shard_utils/tensor_shard_strategy.py
imports: from typing import List, Optional
  import torch
  import torch.distributed
  from colossalai.legacy.zero.gemini.tensor_utils import colo_model_data_tensor_move_inline
  from colossalai.legacy.zero.shard_utils import BaseShardStrategy
  from colossalai.legacy.zero.shard_utils.commons import get_shard
  from colossalai.legacy.zero.sharded_param.sharded_tensor import ShardedTensor
  from colossalai.utils import get_current_device
label_desc: Use image node_id 4 for calling the TensorShardStrategy obj's underlying member method code with example usage: obj._gather_tensor(t, process_group) without return types