code: def pyt_tensor2np(pyt_tensor):
      if pyt_tensor is None:
          return None
      if isinstance(pyt_tensor, torch.Tensor):
          n = pyt_tensor.data.cpu().numpy()
          if len(n.shape) == 1:
              return n[0]
          else:
              return n
      elif isinstance(pyt_tensor, np.ndarray):
          return pyt_tensor
      else:
          return np.array(pyt_tensor)
  
file_path: tensorwatch/tensorwatch/data_utils.py
imports: import random
  import scipy.spatial.distance
  import heapq
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: pyt_tensor2np(pyt_tensor) and returns: None, n, n, pyt_tensor, np