code: def print_summary(scopes=None):
      scopes = parse_scopes(scopes)
      for scope in scopes:
          if scope is not None:
              print("Scope: %s" % scope)
          weights = tf.get_collection(
              tf.GraphKeys.GLOBAL_VARIABLES, scope=scope + "/"
          )
          names = [w.name for w in weights]
          starts = [n.rfind("/") + 1 for n in names]
          ends = [n.rfind(":") for n in names]
  
          layers = sum(
              [
                  n[s:e] == "weights"
                  for (n, s, e) in zip(names, starts, ends)
              ]
          )
          parameters = sum([w.shape.num_elements() for w in weights])
          print("Total layers: %d" % layers)
          print("Total weights: %d" % len(weights))
          print("Total parameters: {:,}".format(parameters))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import warnings
  from contextlib import contextmanager
  from .version_utils import tf_later_than
label_desc: Use image node_id 6 for calling a global function with example usage: print_summary(scopes) without return types