code: def nested_model_guide(include_obs=True, dim1=11, dim2=7):
      p0 = torch.tensor(
          math.exp(-0.40 - include_obs * 0.2), requires_grad=True
      )
      p1 = torch.tensor(
          math.exp(-0.33 - include_obs * 0.1), requires_grad=True
      )
      pyro.sample("a1", dist.Bernoulli(p0 * p1))
      for i in pyro.plate("plate", dim1):
          pyro.sample("b{}".format(i), dist.Bernoulli(p0))
          with pyro.plate("plate_{}".format(i), dim2 + i) as ind:
              c_i = pyro.sample(
                  "c{}".format(i),
                  dist.Bernoulli(p1).expand_by([len(ind)]),
              )
              assert c_i.shape == (dim2 + i,)
              if include_obs:
                  obs_i = pyro.sample(
                      "obs{}".format(i),
                      dist.Bernoulli(c_i),
                      obs=torch.ones(c_i.size()),
                  )
                  assert obs_i.shape == (dim2 + i,)
  
imports: import math
  from collections import defaultdict
  import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer.tracegraph_elbo import TrackNonReparam, _compute_downstream_costs
  from pyro.infer.util import MultiFrameTensor, get_plate_stacks
  from pyro.ops.provenance import get_provenance
  from pyro.poutine.util import prune_subsample_sites
  from tests.common import assert_equal
label_desc: Use image node_id 8 for calling a global function with example usage: nested_model_guide(include_obs, dim1, dim2) without return types