code: def test_plate_dim_allocation_ok(plate_dims):
      def model():
          p = torch.tensor(0.5, requires_grad=True)
          with pyro.plate("plate_outer", 5, dim=plate_dims[0]):
              pyro.sample("x", dist.Bernoulli(p))
              with pyro.plate("plate_inner_1", 6, dim=plate_dims[1]):
                  pyro.sample("y", dist.Bernoulli(p))
                  with pyro.plate(
                      "plate_inner_2", 7, dim=plate_dims[2]
                  ):
                      pyro.sample("z", dist.Bernoulli(p))
                      with pyro.plate(
                          "plate_inner_3", 8, dim=plate_dims[3]
                      ):
                          pyro.sample("q", dist.Bernoulli(p))
  
      assert_ok(model, max_plate_nesting=4)
  
file_path: pyro/tests/contrib/funsor/test_valid_models_plate.py
imports: import logging
  import pytest
  import torch
  from pyro.ops.indexing import Vindex
  from tests.common import xfail_param
label_desc: Use image node_id 2 for calling a global function with example usage: test_plate_dim_allocation_ok(plate_dims) without return types