code: def test_enum_recycling_chain_while(history):
      @infer.config_enumerate
      def model():
          p = torch.tensor([[0.2, 0.8], [0.1, 0.9]])
  
          xs = [0]
          c = pyro.markov(history=history)
          with contextlib.ExitStack() as stack:
              for t in range(100):
                  stack.enter_context(c)
                  xs.append(
                      pyro.sample(
                          "x_{}".format(t), dist.Categorical(p[xs[-1]])
                      )
                  )
              assert all(x.dim() <= history + 1 for x in xs[1:])
  
      assert_ok(model, max_plate_nesting=0)
  
imports: import contextlib
  import logging
  import os
  from collections import defaultdict
  from queue import LifoQueue
  import pytest
  import torch
  from pyro.infer.enum import iter_discrete_escape, iter_discrete_extend
  from pyro.ops.indexing import Vindex
  from pyro.poutine import Trace
  from pyro.poutine.util import prune_subsample_sites
  from pyro.util import check_traceenum_requirements
label_desc: Use image node_id 5 for calling a global function with example usage: test_enum_recycling_chain_while(history) without return types