code: def test_iteration_fresh():
      def testing():
          for i in pyro.markov(range(5)):
              fv1 = pyro.to_funsor(
                  torch.zeros(2), funsor.Real, dim_to_name={-1: str(i)}
              )
              fv2 = pyro.to_funsor(
                  torch.ones(2), funsor.Real, dim_to_name={-1: "a"}
              )
              v1 = pyro.to_data(fv1)
              v2 = pyro.to_data(fv2)
              print(i, v1.shape)  # shapes should alternate
              if i % 2 == 0:
                  assert v1.shape == (2,)
              else:
                  assert v1.shape == (2, 1, 1)
              assert v2.shape == (2, 1)
              print(i, fv1.inputs)
              print("a", v2.shape)  # shapes should stay the same
              print("a", fv2.inputs)
  
      with pyro_backend("contrib.funsor"), NamedMessenger(
          first_available_dim=-1
      ):
          testing()
  
file_path: pyro/tests/contrib/funsor/test_named_handlers.py
imports: import logging
  from collections import OrderedDict
  import pytest
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: test_iteration_fresh() without return types