code: def beta_binomial_dist(
      concentration1, concentration0, total_count, *, overdispersion=0.0
  ):
      """
      Returns a Beta-Binomial distribution that is an overdispersed version of a
      the usual Beta-Binomial distribution, according to an extra parameter
      ``overdispersion``, typically set in the range 0.1 to 0.5.
  
      :param concentration1: 1st concentration parameter (alpha) for the
          Beta distribution.
      :type concentration1: float or torch.Tensor
      :param concentration0: 2nd concentration parameter (beta) for the
          Beta distribution.
      :type concentration0: float or torch.Tensor
      :param total_count: Number of Bernoulli trials.
      :type total_count: float or torch.Tensor
      :param overdispersion: Amount of overdispersion, in the half open interval
          [0,2). Defaults to zero.
      :type overdispersion: float or torch.tensor
      """
      _validate_overdispersion(overdispersion)
      if not _is_zero(overdispersion):
          # Compute harmonic sum of two sources of concentration resulting in
          # final concentration c = 1 / (1 / c_1 + 1 / c_2)
          od2 = (overdispersion + 1e-8) ** 2
          c_1 = concentration1 + concentration0
          c_2 = (
              c_1**2 / (concentration1 * concentration0 * od2 + 1e-8)
              - 1
          )
          factor = 1 + c_1 / c_2
          concentration1 = concentration1 / factor
          concentration0 = concentration0 / factor
  
      if _RELAX:
          return _relaxed_beta_binomial(
              concentration1, concentration0, total_count
          )
      return dist.ExtendedBetaBinomial(
          concentration1, concentration0, total_count
      )
  
file_path: pyro/pyro/contrib/epidemiology/distributions.py
imports: import math
  from contextlib import contextmanager
  import torch
  from torch.distributions.utils import broadcast_all
  import pyro.distributions
  from pyro.distributions.util import is_validation_enabled
label_desc: Use image node_id 10 for calling a global function with example usage: beta_binomial_dist(concentration1, concentration0, total_count) and returns: dist, _relaxed_beta_binomial