code: def test_uniform(shape, dim, flip):
      def model():
          with pyro.plate_stack("plates", shape[:dim]):
              with pyro.plate("particles", 10000):
                  pyro.sample(
                      "x",
                      dist.Uniform(0, 1).expand(shape).to_event(-dim),
                  )
  
      value = poutine.trace(model).get_trace().nodes["x"]["value"]
      expected_probe = get_moments(value)
  
      reparam_model = poutine.reparam(
          model, {"x": HaarReparam(dim=dim, flip=flip)}
      )
      trace = poutine.trace(reparam_model).get_trace()
      assert isinstance(
          trace.nodes["x_haar"]["fn"], dist.TransformedDistribution
      )
      assert isinstance(trace.nodes["x"]["fn"], dist.Delta)
      value = trace.nodes["x"]["value"]
      actual_probe = get_moments(value)
      assert_close(actual_probe, expected_probe, atol=0.1)
  
file_path: pyro/tests/infer/reparam/test_haar.py
imports: import pytest
  import torch
  from torch.autograd import grad
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.distributions.transforms.haar import HaarTransform
  from pyro.infer.autoguide.initialization import InitMessenger, init_to_value
  from pyro.infer.reparam import HaarReparam
  from tests.common import assert_close
  from .util import check_init_reparam
label_desc: Use image node_id 3 for calling a global function with example usage: test_uniform(shape, dim, flip) without return types