code: def _check_model_guide_enumeration_constraint(
      model_enum_sites, guide_trace
  ):
      min_ordinal = frozenset.intersection(*model_enum_sites.keys())
      for name, site in guide_trace.nodes.items():
          if (
              site["type"] == "sample"
              and site["infer"].get("_enumerate_dim") is not None
          ):
              for f in site["cond_indep_stack"]:
                  if (
                      f.vectorized
                      and guide_trace.plate_to_symbol[f.name]
                      not in min_ordinal
                  ):
                      raise ValueError(
                          "Expected model enumeration to be no more global than guide enumeration, "
                          "but found model enumeration sites upstream of guide site '{}' in plate('{}'). "
                          "Try converting some model enumeration sites to guide enumeration sites.".format(
                              name, f.name
                          )
                      )
  
imports: import queue
  import warnings
  import weakref
  from collections import OrderedDict
  import torch
  from opt_einsum import shared_intermediates
  import pyro
  import pyro.distributions
  import pyro.ops.jit
  import pyro.poutine
  from pyro.distributions.util import is_identically_zero
  from pyro.infer.elbo import ELBO
  from pyro.infer.enum import get_importance_trace, iter_discrete_escape, iter_discrete_extend
  from pyro.infer.util import Dice, is_validation_enabled
  from pyro.ops import packed
  from pyro.ops.contract import contract_tensor_tree, contract_to_tensor
  from pyro.ops.rings import SampleRing
  from pyro.poutine.enum_messenger import EnumMessenger
  from pyro.util import check_traceenum_requirements, ignore_jit_warnings, warn_if_nan
label_desc: Use image node_id 2 for calling a global function with example usage: _check_model_guide_enumeration_constraint(model_enum_sites, guide_trace) without return types