code: def test_combine_parallel_conv2d():
      """Simple testcase."""
  
      def before(x, w1, w2, w3, w4):
          args = [x, w1, w2, w3, w4]
          y1 = relay.nn.conv2d(x, w1)
          y2 = relay.nn.conv2d(x, w2)
          # y3 cannot be combined
          y3 = relay.nn.conv2d(x, w3)
          y4 = relay.nn.conv2d(x, w4)
          y5 = relay.nn.max_pool2d(x)
          y = relay.Tuple((y1, y2, y3, y4, y5))
          return relay.Function(args, y)
  
      def expected(
          x, w1, w2, w3, w4, channels1, channels2, channels3, channels4
      ):
          # use a fixed order of args so alpha equal check can pass
          args = [x, w1, w2, w3, w4]
          w = relay.concatenate((w1, w2, w4), axis=0)
          y = relay.nn.conv2d(
              x, w, channels=channels1 + channels2 + channels4
          )
          y1 = relay.strided_slice(
              y,
              begin=[0, 0],
              end=[-1, channels1],
              strides=[1, 1],
              slice_mode="size",
          )
          y2 = relay.strided_slice(
              y,
              begin=[0, channels1],
              end=[-1, channels2],
              strides=[1, 1],
              slice_mode="size",
          )
          y3 = relay.nn.conv2d(x, w3)
          y4 = relay.strided_slice(
              y,
              begin=[0, channels1 + channels2],
              end=[-1, channels4],
              strides=[1, 1],
              slice_mode="size",
          )
          y5 = relay.nn.max_pool2d(x)
          y = relay.Tuple((y1, y2, y3, y4, y5))
          return relay.Function(args, y)
  
      def check(x_shape, channels1, channels2, channels3, channels4):
          x = relay.var("x", shape=x_shape)
          in_c = x_shape[1]
          w1 = relay.var("w1", shape=(channels1, in_c, 1, 1))
          w2 = relay.var("w2", shape=(channels2, in_c, 1, 1))
          w3 = relay.var("w3", shape=(channels3, in_c, 3, 3))
          w4 = relay.var("w4", shape=(channels4, in_c, 1, 1))
  
          y_before = before(x, w1, w2, w3, w4)
          y = run_opt_pass(
              y_before,
              transform.CombineParallelConv2D(min_num_branches=2),
          )
          y_expected = expected(
              x,
              w1,
              w2,
              w3,
              w4,
              channels1,
              channels2,
              channels3,
              channels4,
          )
          y_expected = run_opt_pass(y_expected, transform.InferType())
          assert tvm.ir.structural_equal(
              y, y_expected, map_free_vars=True
          )
  
      check((1, 4, 16, 16), 4, 4, 4, 4)
      check((1, 4, 16, 16), 4, 8, 4, 7)
  
file_path: tvm/tests/python/relay/test_pass_combine_parallel_conv2d.py
imports: import tvm
  from tvm import relay
  from tvm.relay import transform
label_desc: Use image node_id 3 for calling a global function with example usage: test_combine_parallel_conv2d() and returns: relay, relay