code: def test_nested():
      pyro.clear_param_store()
  
      def model():
          latent = named.Object("latent")
          latent.list = named.List()
          loc = latent.list.add().loc.param_(torch.zeros(1))
          latent.dict = named.Dict()
          foo = latent.dict["foo"].foo.sample_(
              dist.Normal(loc, torch.ones(1))
          )
          latent.object.bar.sample_(
              dist.Normal(loc, torch.ones(1)), obs=foo
          )
  
      tr = poutine.trace(model).get_trace()
      assert get_sample_names(tr) == set(["latent.dict['foo'].foo"])
      assert get_observe_names(tr) == set(["latent.object.bar"])
      assert get_param_names(tr) == set(["latent.list[0].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 7 for calling a global function with example usage: test_nested() without return types