code: def test_gof(continuous_dist):
      Dist = continuous_dist.pyro_dist
      if Dist in [dist.LKJ, dist.LKJCholesky]:
          pytest.xfail(reason="incorrect submanifold scaling")
  
      num_samples = 50000
      for i in range(continuous_dist.get_num_test_data()):
          d = Dist(**continuous_dist.get_dist_params(i))
          with torch.random.fork_rng():
              samples = d.sample(torch.Size([num_samples]))
          with xfail_if_not_implemented():
              probs = d.log_prob(samples).exp()
  
          dim = None
          if "ProjectedNormal" in Dist.__name__:
              dim = samples.size(-1) - 1
  
          # Test each batch independently.
          probs = probs.reshape(num_samples, -1)
          samples = samples.reshape(probs.shape + d.event_shape)
          if "Dirichlet" in Dist.__name__:
              # The Dirichlet density is over all but one of the probs.
              samples = samples[..., :-1]
          for b in range(probs.size(-1)):
              gof = auto_goodness_of_fit(
                  samples[:, b], probs[:, b], dim=dim
              )
              assert gof > TEST_FAILURE_RATE
  
imports: import numpy
  import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro.distributions import TorchDistribution
  from pyro.distributions.testing.gof import auto_goodness_of_fit
  from pyro.distributions.util import broadcast_shape
  from tests.common import TEST_FAILURE_RATE, assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 10 for calling a global function with example usage: test_gof(continuous_dist) without return types