code: def test_plate_dependency():
      #   w                              w
      #     \  x1 x2      unroll    x1  / \  x2
      #      \  || y1 y2  =====>  y1 | /   \ | y2
      #       \ || //               \|/     \|/
      #        z1 z2                z1       z2
      #
      # This allows posterior dependency structure:
      #
      #     w x x y y z z
      #   w ? ? ? ? ? ? ?
      #   x   ?   ?   ?
      #   x     ?   ?   ?
      #   y       ?   ?
      #   y         ?   ?
  
      def model(data):
          w = pyro.sample("w", dist.Normal(0, 1))
          with pyro.plate("p", len(data)):
              x = pyro.sample("x", dist.Normal(0, 1))
              y = pyro.sample("y", dist.Normal(0, 1))
              pyro.sample("z", dist.Normal(w + x + y, 1), obs=data)
  
      data = torch.rand(2)
      actual = get_dependencies(model, (data,))
      _ = set()
      expected = {
          "prior_dependencies": {
              "w": {"w": _},
              "x": {"x": _},
              "y": {"y": _},
              "z": {"w": _, "x": _, "y": _, "z": _},
          },
          "posterior_dependencies": {
              "w": {"w": _, "x": _, "y": _, "z": _},
              "x": {"x": _, "y": _, "z": _},
              "y": {"y": _, "z": _},
          },
      }
      assert actual == expected
  
imports: import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro.distributions.testing.fakes import NonreparameterizedNormal
  from pyro.infer.inspect import _deep_merge, get_dependencies, get_model_relations
label_desc: Use image node_id 12 for calling a global function with example usage: test_plate_dependency() without return types