code: def test_enumeration_in_tree(Eval):
      @poutine.enum(first_available_dim=-5)
      @config_enumerate
      @poutine.condition(
          data={
              "sample1": torch.tensor(0.0),
              "sample2": torch.tensor(1.0),
              "sample3": torch.tensor(2.0),
          }
      )
      def model():
          outer = pyro.plate("outer", 2, dim=-1)
          inner1 = pyro.plate("inner1", 2, dim=-3)
          inner2 = pyro.plate("inner2", 3, dim=-2)
          inner3 = pyro.plate("inner3", 2, dim=-4)
  
          d = dist.Bernoulli(0.3)
          n = dist.Normal(0.0, 1.0)
          pyro.sample("y", d)
          pyro.sample("sample1", n)
          with outer, inner2:
              pyro.sample("z0", d)
              pyro.sample("sample2", n)
          with outer:
              pyro.sample("z1", d)
              pyro.sample("sample3", n)
              with inner1, inner3:
                  pyro.sample("z2", d)
              with inner2:
                  pyro.sample("z3", d)
  
      model_trace = poutine.trace(model).get_trace()
      print_debug_info(model_trace)
      trace_prob_evaluator = Eval(model_trace, True, 4)
      # p_n(0.) * p_n(2.)^2 * p_n(1.)^6
      assert_equal(
          trace_prob_evaluator.log_prob(model_trace),
          torch.tensor(-15.2704),
          prec=1e-4,
      )
  
imports: import io
  import logging
  import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer import config_enumerate
  from pyro.infer.mcmc import HMC, NUTS
  from pyro.infer.mcmc.api import MCMC
  from pyro.infer.mcmc.util import TraceEinsumEvaluator, TraceTreeEvaluator, initialize_model
  from pyro.infer.reparam import LatentStableReparam
  from pyro.poutine.subsample_messenger import _Subsample
  from tests.common import assert_close, assert_equal, xfail_param
label_desc: Use image node_id 8 for calling a global function with example usage: test_enumeration_in_tree(Eval) without return types