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