code: def test_simple_recur():
      @scope
      def geometric(p):
          x = pyro.sample("x", dist.Bernoulli(p))
          if x.item() == 1.0:
              # model1()
              return x + geometric(p)
          else:
              return x
  
      prev_name = "x"
      for name, node in (
          poutine.trace(name_count(geometric))
          .get_trace(0.9)
          .nodes.items()
      ):
          if node["type"] == "sample":
              logger.debug(name)
              assert name == "geometric/" + prev_name
              prev_name = "geometric/" + prev_name
  
file_path: pyro/tests/contrib/autoname/test_scoping.py
imports: import logging
  import torch
  import pyro
  import pyro.distributions.torch
  import pyro.poutine
  from pyro.contrib.autoname import name_count, scope
label_desc: Use image node_id 5 for calling a global function with example usage: test_simple_recur() and returns: unknown, x