code: def compute_predictive_bounds(
      predictive_dist, anomaly_threshold=0.01
  ):
      """Computes upper and lower bounds (and mean) of the predicted series.
  
      Args:
        predictive_dist: instance of `tfd.Distribution` having event shape `[]` and
          batch shape `[..., num_steps]`, as returned by
          `tfp.sts.one_step_predictive`.
        anomaly_threshold: scalar float `Tensor` probability mass to leave uncovered
          by the returned intervals. For example, given
          `anomaly_threshold=0.01`, the interval from `lower_limit` to `upper_limit`
          will contain 99% of the probability mass of `predictive_dist`.
          Default value: `0.01`.
      Returns:
        lower_limit: float `Tensor` lower bound of shape
          `predictive_dist.batch_shape`.
        upper_limit: float `Tensor` upper bound of shape
          `predictive_dist.batch_shape`.
        predictive_mean: float `Tensor` predictive mean of shape
          `predictive_dist.batch_shape`. Note that this is the mean, not the
          median, so it is theoretically possible (though unlikely) that it can lie
          outside of the bounds.
      """
      anomaly_threshold = tf.convert_to_tensor(
          anomaly_threshold,
          dtype_hint=predictive_dist.dtype,
          name="anomaly_threshold",
      )
  
      # Since quantiles of a mixture distribution are not analytically available,
      # use scalar root search to compute the upper and lower bounds. The search
      # assumes that the lower and upper bounds are no more than 100 standard
      # deviations away from the mean.
      predictive_mean = predictive_dist.mean()
      predictive_stddev = predictive_dist.stddev()
      target_log_cdfs = tf.reshape(
          [
              tf.math.log(anomaly_threshold / 2.0),
              tf.math.log1p(-anomaly_threshold / 2.0),
          ],
          ps.concat(
              [[2], ps.ones_like(ps.shape(predictive_mean))], axis=0
          ),
      )
      limits, _, _ = root_search.find_root_chandrupatla(
          lambda x: target_log_cdfs - predictive_dist.log_cdf(x),
          low=predictive_mean - 100 * predictive_stddev,
          high=predictive_mean + 100 * predictive_stddev,
      )
      return limits[0], limits[1], predictive_mean
  
imports: import collections
  import datetime
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.sts_gibbs import gibbs_sampler
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math import root_search
  from tensorflow_probability.python.sts import default_model
  from tensorflow_probability.python.sts import regularization
  from tensorflow_probability.python.sts.forecast import one_step_predictive
  from tensorflow_probability.python.sts.internal import seasonality_util
  from tensorflow_probability.python.sts.internal import util
label_desc: Use image node_id 4 for calling a global function with example usage: compute_predictive_bounds(predictive_dist, anomaly_threshold) and returns: limits,  limits,  predictive_mean