code: def get_variable_memory_size(obj):
      # If it's a PyTorch tensor and on the GPU
      import torch
  
      if torch.is_tensor(obj) and obj.is_cuda:
          return obj.element_size() * obj.nelement()
      else:
          return sys.getsizeof(obj)
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/tools/res_measure.py
imports: import os
  import psutil
  import gpustat
  import threading
  import time
  from src.tools.io_tools import write_json
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: get_variable_memory_size(obj) and returns: unknown, sys