code: def nested_model_guide2(include_obs=True, dim1=3, dim2=2):
      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))
      with pyro.plate("plate1", dim1) as ind:
          c = pyro.sample("c", dist.Bernoulli(p1).expand_by([len(ind)]))
          assert c.shape == (dim1,)
          for i in pyro.plate("plate2", dim2):
              b_i = pyro.sample(
                  "b{}".format(i),
                  dist.Bernoulli(p0).expand_by([len(ind)]),
              )
              assert b_i.shape == (dim1,)
              if include_obs:
                  obs_i = pyro.sample(
                      "obs{}".format(i),
                      dist.Bernoulli(b_i),
                      obs=torch.ones(b_i.size()),
                  )
                  assert obs_i.shape == (dim1,)
  
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 10 for calling a global function with example usage: nested_model_guide2(include_obs, dim1, dim2) without return types