code: def test_fastnlp_paddle_broadcast_object(self, src_rank):
      if self.local_rank == src_rank:
          obj = {
              "tensor": paddle.full(
                  shape=(2,), fill_value=self.local_rank
              ).cuda(),
              "numpy": np.full(shape=(2,), fill_value=self.local_rank),
              "bool": self.local_rank % 2 == 0,
              "float": self.local_rank + 0.1,
              "int": self.local_rank,
              "dict": {"rank": self.local_rank},
              "list": [self.local_rank] * 2,
              "str": f"{self.local_rank}",
              "tensors": [
                  paddle.full(
                      shape=(2,), fill_value=self.local_rank
                  ).cuda(),
                  paddle.full(
                      shape=(2,), fill_value=self.local_rank
                  ).cuda(),
              ],
          }
      else:
          obj = None
      data = fastnlp_paddle_broadcast_object(
          obj, src=src_rank, device=paddle.device.get_device()
      )
      assert data["tensor"][0] == src_rank
      assert data["numpy"][0] == src_rank
      assert data["bool"] == (src_rank % 2 == 0)
      assert np.allclose(data["float"], src_rank + 0.1)
      assert data["int"] == src_rank
      assert data["dict"]["rank"] == src_rank
      assert data["list"][0] == src_rank
      assert data["str"] == f"{src_rank}"
      assert data["tensors"][0][0] == src_rank
  
      for obj in [
          self.local_rank,
          bool(self.local_rank == 1),
          str(self.local_rank),
      ]:
          data = fastnlp_paddle_broadcast_object(
              obj, src=0, device=paddle.device.get_device()
          )
          assert int(data) == 0
      dist.barrier()
  
file_path: fastNLP/tests/core/drivers/paddle_driver/test_dist_utils.py
imports: import os
  import sys
  import signal
  import pytest
  import traceback
  import numpy
  from fastNLP.core.drivers.paddle_driver.dist_utils import _tensor_to_object, _object_to_tensor, fastnlp_paddle_all_gather, fastnlp_paddle_broadcast_object
  from fastNLP.core.drivers.paddle_driver.fleet_launcher import FleetLauncher
  from tests.helpers.utils import magic_argv_env_context
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
label_desc: Use image node_id 4 for calling the TestAllGatherAndBroadCast obj's underlying member method code with example usage: obj.test_fastnlp_paddle_broadcast_object(src_rank) without return types