code: def test_context_manager():
      @autoname
      def f1():
          return sample(dist.Bernoulli(0.5))
  
      def f2():
          with autoname(name="prefix"):
              f1()
              f1()
  
      tr2 = poutine.trace(f2).get_trace()
      assert "prefix/f1/Bernoulli" in tr2.nodes
      assert "prefix/f1__1/Bernoulli" in tr2.nodes
  
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 9 for calling a global function with example usage: test_context_manager() and returns: sample