docs: def count_variables_by_type(variables=None):
    """Returns a dict mapping dtypes to number of variables and scalars.
  
    Args:
      variables: iterable of `tf.Variable`s, or None. If None is passed, then all
        global and local variables in the current graph are used.
  
    Returns:
      A dict mapping tf.dtype keys to a dict containing the keys 'num_scalars' and
        'num_variables'.
    """
    if variables is None:
      variables = tf.global_variables() + tf.local_variables()
    unique_types = set(v.dtype.base_dtype for v in variables)
    results_dict = {}
    for dtype in unique_types:
      if dtype == tf.string:
        tf.logging.warning(
            "NB: string Variables present. The memory usage for these  Variables "
            "will not be accurately computed as it depends on the exact strings "
            "stored in a particular session.")
      vars_of_type = [v for v in variables if v.dtype.base_dtype == dtype]
      num_scalars = sum(v.shape.num_elements() for v in vars_of_type)
      results_dict[dtype] = {
          "num_variables": len(vars_of_type),
          "num_scalars": num_scalars
      }
    return results_dict