code: def test_parallel_merge():
      r"""Tests that parallel patterns relying on the same inputs are correctly merged.
  
      The test graph is difficult to draw out as ascii art. It is essentially two parallel
      add-sub-mul units which both consume input_1 and input_2 with their results being multiplied
      to give the output. We expect both parallel branches should get merged and both should still
      consume the same input variables, input_1 and input_2."""
  
      def before():
          input_1 = relay.var("input_1", shape=(10, 10))
          input_2 = relay.var("input_2", shape=(10, 10))
          branch_1_add = relay.add(input_1, input_2)
          branch_1_sub = relay.subtract(input_1, input_2)
          branch_1 = relay.multiply(branch_1_add, branch_1_sub)
          branch_2_add = relay.add(input_1, input_2)
          branch_2_sub = relay.subtract(input_1, input_2)
          branch_2 = relay.multiply(branch_2_add, branch_2_sub)
          out = relay.multiply(branch_1, branch_2)
          return relay.Function([input_1, input_2], out)
  
      def expected():
          input_1 = relay.var("input_1", shape=(10, 10))
          input_2 = relay.var("input_2", shape=(10, 10))
          x = relay.var("x")
          y = relay.var("y")
          branch_1 = relay.multiply(
              relay.add(x, y), relay.subtract(x, y)
          )
          func_1 = relay.Function([x, y], branch_1)
          func_1 = func_1.with_attr("Composite", "add_sub_mul")
          func_1 = func_1.with_attr(
              "PartitionedFromPattern", "add_subtract_multiply_"
          )
          call_1 = relay.Call(func_1, [input_1, input_2])
          x1 = relay.var("x1")
          y1 = relay.var("y1")
          branch_2 = relay.multiply(
              relay.add(x1, y1), relay.subtract(x1, y1)
          )
          func_2 = relay.Function([x1, y1], branch_2)
          func_2 = func_2.with_attr("Composite", "add_sub_mul")
          func_2 = func_2.with_attr(
              "PartitionedFromPattern", "add_subtract_multiply_"
          )
          call_2 = relay.Call(func_2, [input_1, input_2])
          out = relay.multiply(call_1, call_2)
          return relay.Function([input_1, input_2], out)
  
      pattern_table = [("add_sub_mul", make_add_sub_mul_pattern())]
      check_result(pattern_table, before(), expected())
  
imports: import pytest
  import tvm
  from tvm import relay, tir
  from tvm.relay.dataflow_pattern import TuplePattern, TupleGetItemPattern, is_op, wildcard
  from tvm.relay.testing import run_opt_pass
label_desc: Use image node_id 14 for calling a global function with example usage: test_parallel_merge() and returns: relay, relay