code: def fastnlp_paddle_gather_object(obj, dst=0, group=None):
      """
      从其它 rank gather 东西到 dst rank 。
  
      Example::
          >>> # Assumes world_size of 3.
          >>> gather_objects = ["foo", 12, {1: 2}] # any picklable object
          >>> output = [None for _ in gather_objects]
          >>> fastnlp_paddle_gather_object(
                  gather_objects[dist.get_rank()],
                  output if dist.get_rank() == 0 else None,
                  dst=0
              )
          >>> # On rank 0
          >>> output
          ['foo', 12, {1: 2}]
  
      :param obj: 需要发送的 obj 对象，需要是可以 pickable 的对象
      :param dst: 目标的 rank 。
      :param group: 在哪个 group 执行该函数。
      :return: 在 dst 上面返回 world_size 的 list，依次为 rank 0；rank 1...上 obj
      """
      if int(os.environ.get(FASTNLP_NO_SYNC, "0")) == 2:
          return [obj]
  
      if dist.get_rank() == dst:
          object_gather_list = [
              None for _ in range(dist.get_world_size())
          ]
      else:
          object_gather_list = None
  
      # if group is None:
      # TODO 2.2 版本存在 bug
      # group = dist.collective._get_global_group()
  
      if group is not None and not group.is_member():
          return
  
      # Ensure object_gather_list is specified appopriately.
      my_rank = dist.get_rank()
      _validate_output_list_for_rank(my_rank, dst, object_gather_list)
      # 防止 unpickle 的时候出现在了发送的 gpu 上。
      obj = paddle_move_data_to_device(obj, device="cpu")
      input_tensor, local_size = _object_to_tensor(obj)
      # 目前 paddle 的 group 仅支持 nccl
      input_tensor = paddle_move_data_to_device(
          input_tensor, device=paddle.device.get_device()
      )
      local_size = paddle_move_data_to_device(
          local_size, device=paddle.device.get_device()
      )
  
      # 收集所有的 local_size，找到最大的 size
      object_size_list = []
      dist.all_gather(object_size_list, local_size, group=group)
      max_object_size = int(max(object_size_list).item())  # type: ignore[type-var]
      input_tensor.reshape_(max_object_size)
      # TODO 暂时没有在 paddle 中发现类似 torch.distributed.gather 的函数
      output_tensors = []
      dist.all_gather(output_tensors, input_tensor, group)
      if my_rank != dst:
          return
      for i, tensor in enumerate(output_tensors):
          tensor = tensor.astype(paddle.uint8)
          tensor_size = object_size_list[i]
          object_gather_list[i] = _tensor_to_object(tensor, tensor_size)
  
file_path: fastNLP/fastNLP/core/drivers/paddle_driver/dist_utils.py
imports: import io
  import pickle
  import os
  from typing import Any, List
  import numpy
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
  from fastNLP.envs.env import FASTNLP_NO_SYNC
  from fastNLP.core.utils import paddle_move_data_to_device
label_desc: Use image node_id 6 for calling a global function with example usage: fastnlp_paddle_gather_object(obj, dst, group) and returns: list