code: def obj2tensor(pyobj, device="cuda"):
      """Serialize picklable python object to tensor."""
      storage = torch.ByteStorage.from_buffer(pickle.dumps(pyobj))
      return torch.ByteTensor(storage).to(device=device)
  
file_path: mmdetection/mmdet/utils/dist_utils.py
imports: import functools
  import pickle
  import warnings
  from collections import OrderedDict
  import numpy
  import torch
  import torch.distributed
  from mmengine.dist import get_dist_info
  from torch._utils import _flatten_dense_tensors, _take_tensors, _unflatten_dense_tensors
label_desc: Use image node_id 4 for calling a global function with example usage: obj2tensor(pyobj, device) and returns: torch