code: def test_bernoulli_latent_model(jit):
      @poutine.broadcast
      def model(data):
          y_prob = pyro.sample("y_prob", dist.Beta(1.0, 1.0))
          with pyro.plate("data", data.shape[0]):
              y = pyro.sample("y", dist.Bernoulli(y_prob))
              z = pyro.sample("z", dist.Bernoulli(0.65 * y + 0.1))
              pyro.sample("obs", dist.Normal(2.0 * z, 1.0), obs=data)
  
      N = 2000
      y_prob = torch.tensor(0.3)
      y = dist.Bernoulli(y_prob).sample(torch.Size((N,)))
      z = dist.Bernoulli(0.65 * y + 0.1).sample()
      data = dist.Normal(2.0 * z, 1.0).sample()
      nuts_kernel = NUTS(
          model,
          max_plate_nesting=1,
          jit_compile=jit,
          ignore_jit_warnings=True,
      )
      mcmc = MCMC(nuts_kernel, num_samples=600, warmup_steps=200)
      mcmc.run(data)
      samples = mcmc.get_samples()
      assert_equal(samples["y_prob"].mean(0), y_prob, prec=0.05)
  
imports: import logging
  import os
  from collections import namedtuple
  import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.optim
  import pyro.poutine
  from pyro.contrib.conjugate.infer import BetaBinomialPair, GammaPoissonPair, collapse_conjugate, posterior_replay
  from pyro.infer import SVI, TraceEnum_ELBO
  from pyro.infer.autoguide import AutoDelta
  from pyro.infer.mcmc import MCMC, NUTS, ArrowheadMassMatrix
  from pyro.util import ignore_jit_warnings
  from tests.common import assert_close, assert_equal
  from .test_hmc import GaussianChain, rmse
label_desc: Use image node_id 10 for calling a global function with example usage: test_bernoulli_latent_model(jit) without return types