code: def test_elbo_enumerate_plates_1(backend):
      #  +-----------------+
      #  | a ----> b   M=2 |
      #  +-----------------+
      #  +-----------------+
      #  | c ----> d   N=3 |
      #  +-----------------+
      # This tests two unrelated plates.
      # Each should remain uncontracted.
      with pyro_backend(backend):
          pyro.param(
              "probs_a",
              torch.tensor([0.45, 0.55]),
              constraint=constraints.simplex,
          )
          pyro.param(
              "probs_b",
              torch.tensor([[0.6, 0.4], [0.4, 0.6]]),
              constraint=constraints.simplex,
          )
          pyro.param(
              "probs_c",
              torch.tensor([0.75, 0.25]),
              constraint=constraints.simplex,
          )
          pyro.param(
              "probs_d",
              torch.tensor([[0.4, 0.6], [0.3, 0.7]]),
              constraint=constraints.simplex,
          )
          b_data = torch.tensor([0, 1])
          d_data = torch.tensor([0, 0, 1])
  
          def auto_model():
              probs_a = pyro.param("probs_a")
              probs_b = pyro.param("probs_b")
              probs_c = pyro.param("probs_c")
              probs_d = pyro.param("probs_d")
              with pyro.plate("a_axis", 2, dim=-1):
                  a = pyro.sample(
                      "a",
                      dist.Categorical(probs_a),
                      infer={"enumerate": "parallel"},
                  )
                  pyro.sample(
                      "b", dist.Categorical(probs_b[a]), obs=b_data
                  )
              with pyro.plate("c_axis", 3, dim=-1):
                  c = pyro.sample(
                      "c",
                      dist.Categorical(probs_c),
                      infer={"enumerate": "parallel"},
                  )
                  pyro.sample(
                      "d", dist.Categorical(probs_d[c]), obs=d_data
                  )
  
          def hand_model():
              probs_a = pyro.param("probs_a")
              probs_b = pyro.param("probs_b")
              probs_c = pyro.param("probs_c")
              probs_d = pyro.param("probs_d")
              for i in range(2):
                  a = pyro.sample(
                      "a_{}".format(i),
                      dist.Categorical(probs_a),
                      infer={"enumerate": "parallel"},
                  )
                  pyro.sample(
                      "b_{}".format(i),
                      dist.Categorical(probs_b[a]),
                      obs=b_data[i],
                  )
              for j in range(3):
                  c = pyro.sample(
                      "c_{}".format(j),
                      dist.Categorical(probs_c),
                      infer={"enumerate": "parallel"},
                  )
                  pyro.sample(
                      "d_{}".format(j),
                      dist.Categorical(probs_d[c]),
                      obs=d_data[j],
                  )
  
          def guide():
              pass
  
          elbo = infer.TraceEnum_ELBO(max_plate_nesting=1)
          elbo = elbo.differentiable_loss if backend == "pyro" else elbo
          auto_loss = elbo(auto_model, guide)
          elbo = infer.TraceEnum_ELBO(max_plate_nesting=0)
          elbo = elbo.differentiable_loss if backend == "pyro" else elbo
          hand_loss = elbo(hand_model, guide)
          _check_loss_and_grads(hand_loss, auto_loss)
  
imports: import warnings
  import pytest
  import funsor
  from funsor.testing import xfail_param
  from funsor.util import get_backend
label_desc: Use image node_id 19 for calling a global function with example usage: test_elbo_enumerate_plates_1(backend) without return types