code: def _make_summary_statistic(attr):
      """Factory for implementing summary statistics, eg, mean, stddev, mode."""
  
      def _fn(self, **kwargs):
          """Implements summary statistic, eg, mean, stddev, mode."""
          sample_shape = ps.reshape(self.sample_shape, shape=[-1])
          x = getattr(self.distribution, attr)(**kwargs)
          shape = ps.concat(
              [
                  self.distribution.batch_shape_tensor(),
                  ps.ones(
                      ps.rank_from_shape(sample_shape),
                      dtype=sample_shape.dtype,
                  ),
                  self.distribution.event_shape_tensor(),
              ],
              axis=0,
          )
          x = tf.reshape(x, shape=shape)
          shape = ps.concat(
              [
                  self.distribution.batch_shape_tensor(),
                  sample_shape,
                  self.distribution.event_shape_tensor(),
              ],
              axis=0,
          )
          return tf.broadcast_to(x, shape)
  
      return _fn
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 1 for calling a global function with example usage: _make_summary_statistic(attr) and returns: _fn, tf