code: def tobytes(arr):
      if isinstance(arr, np.ndarray):
          return arr.tobytes()
      else:
          return arr.numpy(force=True).tobytes()
  
file_path: pgmpy/pgmpy/utils/compat_fns.py
imports: from copy import deepcopy
  import numpy
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: tobytes(arr) and returns: arr, arr