code: def _instance_count_by_class():
      counter = collections.Counter()
  
      for obj in gc.get_objects():
          try:
              counter[obj.__class__.__name__] += 1
          except Exception:  # pylint:disable=broad-except
              pass
  
      return counter
  
imports: import collections
  import gc
  import time
  from tensorflow.python.eager import context
label_desc: Use image node_id 1 for calling a global function with example usage: _instance_count_by_class() and returns: counter