code: def test_enum_log_prob_discrete_observed(
      data, expected_log_prob, Eval
  ):
      @poutine.enum(first_available_dim=-2)
      @config_enumerate
      @poutine.condition(data={"p": torch.tensor(0.4)})
      def model(data):
          p = pyro.sample("p", dist.Uniform(0.0, 1.0))
          y = pyro.sample("y", dist.Bernoulli(p))
          q = 0.25 * y + 0.5
          with pyro.plate("data", len(data)):
              pyro.sample("obs", dist.Bernoulli(q), obs=data)
  
      model_trace = poutine.trace(model).get_trace(data)
      print_debug_info(model_trace)
      trace_prob_evaluator = Eval(model_trace, True, 1)
      assert_equal(
          trace_prob_evaluator.log_prob(model_trace),
          expected_log_prob,
          prec=1e-3,
      )
  
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 12 for calling a global function with example usage: test_enum_log_prob_discrete_observed(data, expected_log_prob, Eval) without return types