code: def assert_dist_close(d1, d2):
      x = torch.arange(float(200))
      p1 = d1.log_prob(x).exp()
      p2 = d2.log_prob(x).exp()
  
      assert (p1.sum() - 1).abs() < 1e-3, "incomplete mass"
      assert (p2.sum() - 1).abs() < 1e-3, "incomplete mass"
  
      mean1 = (p1 * x).sum()
      mean2 = (p2 * x).sum()
      assert_close(mean1, mean2, rtol=0.05)
  
      max_prob = torch.max(p1.max(), p2.max())
      assert (p1 - p2).abs().max() / max_prob < 0.05
  
imports: import math
  import pytest
  import torch
  from torch.distributions.transforms import SigmoidTransform
  import pyro.distributions
  from pyro.contrib.epidemiology import beta_binomial_dist, binomial_dist, infection_dist
  from pyro.contrib.epidemiology.distributions import _RELAX_MIN_VARIANCE, set_relaxed_distributions
  from tests.common import assert_close
label_desc: Use image node_id 1 for calling a global function with example usage: assert_dist_close(d1, d2) without return types