code: def test_nested_plate():
      @autoname
      def f1():
          return sample(dist.Bernoulli(0.5))
  
      @autoname(name="model")
      def f2():
          for i in autoname(pyro.plate(name="data", size=3)):
              for j in autoname(range(2), name="xy"):
                  f1()
          return sample(dist.Bernoulli(0.5))
  
      expected_names = [
          "model/data/xy/f1/Bernoulli",
          "model/data/xy__1/f1/Bernoulli",
          "model/data__1/xy/f1/Bernoulli",
          "model/data__1/xy__1/f1/Bernoulli",
          "model/data__2/xy/f1/Bernoulli",
          "model/data__2/xy__1/f1/Bernoulli",
          "model/Bernoulli",
      ]
  
      tr = poutine.trace(f2).get_trace()
      actual_names = [
          name
          for name, node in tr.nodes.items()
          if node["type"] == "sample"
          and type(node["fn"]).__name__ != "_Subsample"
      ]
      assert expected_names == actual_names
  
file_path: pyro/tests/contrib/autoname/test_autoname.py
imports: import torch
  import pyro
  import pyro.distributions.torch
  import pyro.poutine
  from pyro.contrib.autoname import autoname, sample
label_desc: Use image node_id 7 for calling a global function with example usage: test_nested_plate() and returns: sample, sample