code: def test_infer_shapes(dist):
      if (
          "LKJ" in dist.pyro_dist.__name__
          or "SineSkewed" in dist.pyro_dist.__name__
      ):
          pytest.xfail(reason="cannot statically compute shape")
      for idx in range(dist.get_num_test_data()):
          dist_params = dist.get_dist_params(idx)
          arg_shapes = {
              k: v.shape if isinstance(v, torch.Tensor) else ()
              for k, v in dist_params.items()
          }
          batch_shape, event_shape = dist.pyro_dist.infer_shapes(
              **arg_shapes
          )
          d = dist.pyro_dist(**dist_params)
          assert d.batch_shape == batch_shape
          assert d.event_shape == event_shape
  
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 3 for calling a global function with example usage: test_infer_shapes(dist) without return types