code: def _serialize(data):
      buf = io.BytesIO()
      torch.save(data, buf)
      data_bytes = buf.getvalue()
      # FIXME: how to properly copy bytes to ByteTensor?
      t = torch.from_numpy(np.frombuffer(data_bytes, dtype=np.uint8))
      return t
  
file_path: PyTorch-BigGraph/torchbiggraph/rpc.py
imports: import io
  import sys
  import traceback
  import numpy
  import torch
  import torch.distributed
label_desc: Use image node_id 1 for calling a global function with example usage: _serialize(data) and returns: t