code: def _check_tmc_elbo_constraint(model_trace, guide_trace):
      num_samples = frozenset(
          site["infer"].get("num_samples")
          for site in guide_trace.nodes.values()
          if site["type"] == "sample"
          and site["infer"].get("enumerate") == "parallel"
          and site["infer"].get("num_samples") is not None
      )
      if len(num_samples) > 1:
          warnings.warn(
              "\n".join(
                  [
                      "Using different numbers of Monte Carlo samples for different guide sites in TraceEnum_ELBO.",
                      "This may be biased if the guide is not factorized",
                  ]
              ),
              UserWarning,
          )
      for name, site in model_trace.nodes.items():
          if (
              site["type"] == "sample"
              and site["infer"].get("enumerate", None) == "parallel"
              and site["infer"].get("num_samples", None)
              and name not in guide_trace
          ):
              warnings.warn(
                  "\n".join(
                      [
                          "Site {} is multiply sampled in model,".format(
                              site["name"]
                          ),
                          "expect incorrect gradient estimates from TraceEnum_ELBO.",
                          "Consider using exact enumeration or guide sampling if possible.",
                      ]
                  ),
                  RuntimeWarning,
              )
  
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 3 for calling a global function with example usage: _check_tmc_elbo_constraint(model_trace, guide_trace) without return types