code: def test_tensor_object_transfer_tensor(device):
      """
      测试 _tensor_to_object 和 _object_to_tensor 二者的结果能否互相转换
      """
      # 张量
      oneflow_tensor = oneflow.rand(3, 4, 5)
      obj_tensor, size = _object_to_tensor(
          oneflow_tensor, device=device
      )
      res = _tensor_to_object(obj_tensor, size)
      assert oneflow.all(res == oneflow_tensor)
  
      # 列表
      oneflow_list = [oneflow.rand(6, 4, 2) for i in range(10)]
      obj_tensor, size = _object_to_tensor(oneflow_list, device=device)
      res = _tensor_to_object(obj_tensor, size)
      assert isinstance(res, list)
      for before, after in zip(oneflow_list, res):
          assert oneflow.all(after == before)
  
      # 元组
      oneflow_list = [oneflow.rand(6, 4, 2) for i in range(10)]
      oneflow_tuple = tuple(oneflow_list)
      obj_tensor, size = _object_to_tensor(oneflow_tuple, device=device)
      res = _tensor_to_object(obj_tensor, size)
      assert isinstance(res, tuple)
      for before, after in zip(oneflow_list, res):
          assert oneflow.all(after == before)
  
      # 字典
      oneflow_dict = {
          "tensor": oneflow.rand(3, 4),
          "list": [oneflow.rand(6, 4, 2) for i in range(10)],
          "dict": {
              "list": [oneflow.rand(6, 4, 2) for i in range(10)],
              "tensor": oneflow.rand(3, 4),
          },
          "int": 2,
          "string": "test string",
      }
      obj_tensor, size = _object_to_tensor(oneflow_dict, device=device)
      res = _tensor_to_object(obj_tensor, size)
      assert isinstance(res, dict)
      assert oneflow.all(res["tensor"] == oneflow_dict["tensor"])
      assert isinstance(res["list"], list)
      for before, after in zip(oneflow_dict["list"], res["list"]):
          assert oneflow.all(after == before)
  
      assert isinstance(res["dict"], dict)
      assert oneflow.all(
          res["dict"]["tensor"] == oneflow_dict["dict"]["tensor"]
      )
      for before, after in zip(
          oneflow_dict["dict"]["list"], res["dict"]["list"]
      ):
          assert oneflow.all(after == before)
      assert res["int"] == oneflow_dict["int"]
      assert res["string"] == oneflow_dict["string"]
  
file_path: fastNLP/tests/core/drivers/oneflow_driver/test_dist_utils.py
imports: import sys
  import os
  import pytest
  import numpy
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW
  from fastNLP.core.drivers.oneflow_driver.dist_utils import _tensor_to_object, _object_to_tensor, fastnlp_oneflow_all_gather, fastnlp_oneflow_broadcast_object
label_desc: Use image node_id 1 for calling a global function with example usage: test_tensor_object_transfer_tensor(device) without return types