code: def test_ubersum_collide_ok_2(impl):
      # The following is ok because z1 can be contracted to x and
      # z2 can be contracted to y.
      #
      # z1,z2 {a,b}
      #       /   \
      #   x {a}  y {b}
      #        \  /
      #       w {}  <--- target
      a, b, c, d = 2, 3, 4, 5
      w = torch.randn(c, d)
      x = torch.randn(a, c)
      y = torch.randn(b, d)
      z1 = torch.randn(a, b, c)
      z2 = torch.randn(a, b, d)
      impl(
          "cd,ac,bd,abc,abd->",
          w,
          x,
          y,
          z1,
          z2,
          plates="ab",
          modulo_total=True,
      )
  
imports: import itertools
  import numbers
  from collections import OrderedDict
  import opt_einsum
  import pytest
  import torch
  import pyro.ops.jit
  from pyro.distributions.util import logsumexp
  from pyro.ops.contract import _partition_terms, contract_tensor_tree, contract_to_tensor, einsum, naive_ubersum, ubersum
  from pyro.ops.einsum.adjoint import require_backward
  from pyro.ops.rings import LogRing
  from pyro.poutine.indep_messenger import CondIndepStackFrame
  from pyro.util import optional
  from tests.common import assert_equal
label_desc: Use image node_id 23 for calling a global function with example usage: test_ubersum_collide_ok_2(impl) without return types