code: def set_approx_log_prob_tol(tol):
      """
      EXPERIMENTAL Context manager / decorator to temporarily set the global
      default value of ``Binomial.approx_log_prob_tol`` and
      ``BetaBinomial.approx_log_prob_tol``, thereby decreasing the computational
      complexity of scoring :class:`~pyro.distributions.Binomial` and
      :class:`~pyro.distributions.BetaBinomial` distributions.
  
      This is used internally by
      :class:`~pyro.contrib.epidemiology.compartmental.CompartmentalModel`.
  
      :param tol: New temporary tolold.
      :type tol: int or float.
      """
      assert isinstance(tol, (float, int))
      assert tol >= 0
      old1 = dist.Binomial.approx_log_prob_tol
      old2 = dist.BetaBinomial.approx_log_prob_tol
      try:
          dist.Binomial.approx_log_prob_tol = tol
          dist.BetaBinomial.approx_log_prob_tol = tol
          yield
      finally:
          dist.Binomial.approx_log_prob_tol = old1
          dist.BetaBinomial.approx_log_prob_tol = old2
  
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 4 for calling a global function with example usage: set_approx_log_prob_tol(tol) without return types