code: def _object_to_tensor(obj, device=None):
      f = io.BytesIO()
      obj = {"protocol_version": PROTOCOL_VERSION, "data": obj}
      pickled_bytes = pickle.dumps(obj)
  
      byte_tensor = oneflow.ByteTensor(list(pickled_bytes))
      local_size = oneflow.LongTensor([byte_tensor.numel()])
      if device is not None:
          byte_tensor = byte_tensor.to(device)
          local_size = local_size.to(device)
      return byte_tensor, local_size
  
file_path: fastNLP/fastNLP/core/drivers/oneflow_driver/dist_utils.py
imports: import io
  import pickle
  import os
  from typing import Any, List
  from fastNLP.core.utils import apply_to_collection, get_oneflow_device
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW
  from fastNLP.envs.env import FASTNLP_NO_SYNC
label_desc: Use image node_id 3 for calling a global function with example usage: _object_to_tensor(obj, device) and returns: byte_tensor,  local_size