code: def get_size(obj, seen=None):
      """Recursively finds size of objects
  
      Taken from https://github.com/bosswissam/pysize
  
      """
  
      size = sys.getsizeof(obj)
      if seen is None:
          seen = set()
  
      obj_id = id(obj)
      if obj_id in seen:
          return 0
  
      # Important mark as seen *before* entering recursion to gracefully handle
      # self-referential objects
      seen.add(obj_id)
  
      if isinstance(obj, dict):
          size += sum([get_size(v, seen) for v in obj.values()])
          size += sum([get_size(k, seen) for k in obj.keys()])
      elif hasattr(obj, "__dict__"):
          size += get_size(obj.__dict__, seen)
      elif isinstance(obj, (list, set, tuple)):
          size += sum([get_size(i, seen) for i in obj])
  
      return size
  
file_path: espnet/espnet2/utils/sized_dict.py
imports: import collections
  import sys
  from torch import multiprocessing
label_desc: Use image node_id 1 for calling a global function with example usage: get_size(obj, seen) and returns: size, int