code: def print_summary(samples, prob=0.9, group_by_chain=True):
      """
      Prints a summary table displaying diagnostics of ``samples`` from the
      posterior. The diagnostics displayed are mean, standard deviation, median,
      the 90% Credibility Interval, :func:`~pyro.ops.stats.effective_sample_size`,
      :func:`~pyro.ops.stats.split_gelman_rubin`.
  
      :param dict samples: dictionary of samples keyed by site name.
      :param float prob: the probability mass of samples within the credibility interval.
      :param bool group_by_chain: If True, each variable in `samples`
          will be treated as having shape `num_chains x num_samples x sample_shape`.
          Otherwise, the corresponding shape will be `num_samples x sample_shape`
          (i.e. without chain dimension).
      """
      if len(samples) == 0:
          return
      summary_dict = summary(samples, prob, group_by_chain)
  
      row_names = {
          k: k
          + "["
          + ",".join(map(lambda x: str(x - 1), v.shape[2:]))
          + "]"
          for k, v in samples.items()
      }
      max_len = max(max(map(lambda x: len(x), row_names.values())), 10)
      name_format = "{:>" + str(max_len) + "}"
      header_format = name_format + " {:>9}" * 7
      columns = [""] + list(list(summary_dict.values())[0].keys())
  
      print()
      print(header_format.format(*columns))
  
      row_format = name_format + " {:>9.2f}" * 7
      for name, stats_dict in summary_dict.items():
          shape = stats_dict["mean"].shape
          if len(shape) == 0:
              print(row_format.format(name, *stats_dict.values()))
          else:
              for idx in product(*map(range, shape)):
                  idx_str = "[{}]".format(",".join(map(str, idx)))
                  print(
                      row_format.format(
                          name + idx_str,
                          *[v[idx] for v in stats_dict.values()],
                      )
                  )
      print()
  
imports: import functools
  import traceback
  import warnings
  from collections import OrderedDict, defaultdict
  from functools import partial, reduce
  from itertools import product
  import torch
  from opt_einsum import shared_intermediates
  from torch.distributions import biject_to
  import pyro
  import pyro.poutine
  from pyro.distributions.util import broadcast_shape, logsumexp
  from pyro.infer import config_enumerate
  from pyro.infer.autoguide.initialization import InitMessenger, init_to_uniform
  from pyro.infer.util import is_validation_enabled
  from pyro.ops import stats
  from pyro.ops.contract import contract_to_tensor
  from pyro.ops.integrator import potential_grad
  from pyro.poutine.subsample_messenger import _Subsample
  from pyro.poutine.util import prune_subsample_sites
  from pyro.util import check_site_shape, ignore_jit_warnings
label_desc: Use image node_id 7 for calling a global function with example usage: print_summary(samples, prob, group_by_chain) without return types