code: def variables_summary(variables, name=None):
      """Returns a list of summarizing `str`s."""
      trainable_size = collections.defaultdict(lambda: 0)
      lines = []
      if name is not None:
          lines.append(" ".join(["=" * 3, name, "=" * 50]))
      fmt = "{: >6} {:20} {:5} {:40}"
      lines.append(
          fmt.format(
              "SIZE",
              "SHAPE",
              "TRAIN",
              "NAME",
          )
      )
      for v in tf.nest.flatten(variables):
          num_elements = tensorshape_util.num_elements(v.shape)
          if v.trainable:
              trainable_size[v.dtype.base_dtype] += num_elements
          lines.append(
              fmt.format(
                  num_elements,
                  str(tensorshape_util.as_list(v.shape)),
                  str(v.trainable),
                  v.name,
              )
          )
      bytes_ = sum([k.size * v for k, v in trainable_size.items()])
      cnt = sum(list(trainable_size.values()))
      lines.append(
          "trainable size: {}  /  {:.3f} MiB  /  {}".format(
              cnt,
              bytes_ / 2**20,
              "{"
              + ", ".join(
                  [
                      "{}: {}".format(k.name, v)
                      for k, v in trainable_size.items()
                  ]
              )
              + "}",
          )
      )
      return "\n".join(lines)
  
imports: import collections
  import contextlib
  import functools
  import sys
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 12 for calling a global function with example usage: variables_summary(variables, name) and returns: str