code: def model_zzxx():
      #                  loc,scale
      #                 /         \
      #       +-------/-+  +--------\------+
      #  z1 --|--> x1   |  |  z2 ---> x2   |
      #       |       3 |  |             2 |
      #       +---------+  +---------------+
      data = [
          torch.tensor([-1.0, -1.0, 0.0]),
          torch.tensor([-1.0, 1.0]),
      ]
      p = pyro.param("p", torch.tensor([0.25, 0.75]))
      loc = pyro.sample(
          "loc", dist.Normal(0, 1).expand([2]).to_event(1)
      )
      # FIXME results in infinite loop in transformeddist_to_funsor.
      # scale = pyro.sample("scale", dist.LogNormal(0, 1))
      scale = pyro.sample("scale", dist.Normal(0, 1)).exp()
      z1 = pyro.sample("z1", dist.Categorical(p))
      with pyro.plate("data[0]", 3):
          pyro.sample("x1", dist.Normal(loc[z1], scale), obs=data[0])
      with pyro.plate("data[1]", 2):
          z2 = pyro.sample("z2", dist.Categorical(p))
          pyro.sample("x2", dist.Normal(loc[z2], scale), obs=data[1])
  
file_path: pyro/tests/contrib/funsor/test_infer_discrete.py
imports: import logging
  import os
  import pyroapi
  import pytest
  import torch
  from pyro.infer.autoguide import AutoNormal
  from tests.common import assert_equal
label_desc: Use image node_id 6 for calling a global function with example usage: model_zzxx() without return types