code: def recv_obj_meta(obj_shape, prev_rank=None) -> torch.Size:
      """Receives obj meta information before receiving a specific obj.
      Since the recipient must know the shape of the obj in p2p communications,
      meta information of the obj should be received before communications. This function
      synchronizes with :func:`send_obj_meta`.
  
      Args:
          obj_shape (Union[:class:`torch.Size`, List[:class:`torch.Size`]]): The shape of the obj to be received.
          prev_rank (int): The rank of the source of the obj.
  
      Returns:
          Union[:class:`torch.Size`, List[:class:`torch.Size`]]: The shape of the obj to be received.
      """
      if obj_shape is None:
          if prev_rank is None:
              prev_rank = gpc.get_prev_global_rank(
                  ParallelMode.PIPELINE
              )
  
          tensor_kwargs = {
              "dtype": torch.long,
              "device": get_current_device(),
          }
          recv_obj_nums = torch.empty((), **tensor_kwargs)
          dist.recv(recv_obj_nums, prev_rank)
          if recv_obj_nums.item() == 1:
              recv_shape = recv_meta_helper(prev_rank, tensor_kwargs)
              obj_shape = torch.Size(recv_shape)
          else:
              obj_shape = []
              for i in range(recv_obj_nums.item()):
                  recv_shape = recv_meta_helper(
                      prev_rank, tensor_kwargs
                  )
                  obj_shape.append(torch.Size(recv_shape))
  
      return obj_shape
  
file_path: colossalai/colossalai/legacy/communication/utils.py
imports: from typing import List, Tuple, Union
  import torch
  import torch.distributed
  from colossalai.legacy.context.parallel_mode import ParallelMode
  from colossalai.legacy.core import global_context
  from colossalai.utils import get_current_device
label_desc: Use image node_id 4 for calling a global function with example usage: recv_obj_meta(obj_shape, prev_rank) and returns: obj_shape