code: def test_named_dict():
      pyro.clear_param_store()
  
      def model():
          latent = named.Dict("latent")
          loc = latent["loc"].param_(torch.zeros(1))
          foo = latent["foo"].sample_(dist.Normal(loc, torch.ones(1)))
          latent["bar"].sample_(
              dist.Normal(loc, torch.ones(1)), obs=foo
          )
          latent["x"].z.sample_(dist.Normal(loc, torch.ones(1)))
  
      tr = poutine.trace(model).get_trace()
      assert get_sample_names(tr) == set(
          ["latent['foo']", "latent['x'].z"]
      )
      assert get_observe_names(tr) == set(["latent['bar']"])
      assert get_param_names(tr) == set(["latent['loc']"])
  
file_path: pyro/tests/contrib/autoname/test_named.py
imports: import torch
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.contrib.autoname import named
label_desc: Use image node_id 6 for calling a global function with example usage: test_named_dict() without return types