class_docstr: Class used to track pytorch memory usage
  Arguments:
      detail(bool, default True): whether the function shows the detail gpu memory usage
      path(str): where to save log file
      verbose(bool, default False): whether show the trivial exception
      device(int): GPU number, default is 0
class_docstr_tok: ["Class","used","to","track","pytorch","memory","usage","Arguments",":","detail","(","bool",",","default","True",")",":","whether","the","function","shows","the","detail","gpu","memory","usage","path","(","str",")",":","where","to","save","log","file","verbose","(","bool",",","default","False",")",":","whether","show","the","trivial","exception","device","(","int",")",":","GPU","number",",","default","is","0"]
code: def get_tensor_usage(self):
      sizes = [
          np.prod(np.array(tensor.size())) * get_mem_space(tensor.dtype)
          for tensor in self.get_tensors()
      ]
      return np.sum(sizes) / 1024**2
  
file_path: h2ogpt/models/gpu_mem_track.py
imports: import gc
  import datetime
  import inspect
  import torch
  import numpy
  import contextlib, sys
label_desc: Use image node_id 3 for calling the MemTracker obj's underlying member method code with example usage: obj.get_tensor_usage() and returns: unknown