code: def test_tuple_get_item_merge():
      """Test composite function can be merged from pattern containing TupleGetItem nodes."""
      pattern_table = [("bn_relu", make_bn_relu_pattern())]
  
      def before():
          x = relay.var("x", shape=(1, 8))
          gamma = relay.var("gamma", shape=(8,))
          beta = relay.var("beta", shape=(8,))
          moving_mean = relay.var("moving_mean", shape=(8,))
          moving_var = relay.var("moving_var", shape=(8,))
          bn_node = relay.nn.batch_norm(
              x, gamma, beta, moving_mean, moving_var
          )
          tuple_get_item_node = bn_node[0]
          r = relay.nn.relu(tuple_get_item_node)
          return relay.Function(
              [x, gamma, beta, moving_mean, moving_var], r
          )
  
      def expected():
          x = relay.var("x", shape=(1, 8))
          beta = relay.var("beta", shape=(8,))
          gamma = relay.var("gamma", shape=(8,))
          moving_mean = relay.var("moving_mean", shape=(8,))
          moving_var = relay.var("moving_var", shape=(8,))
  
          # bn_relu function
          in_1 = relay.var("x1", shape=(1, 8))
          in_2 = relay.var("gamma1", shape=(8,))
          in_3 = relay.var("beta1", shape=(8,))
          in_4 = relay.var("moving_mean1", shape=(8,))
          in_5 = relay.var("moving_var1", shape=(8,))
          bn_node = relay.nn.batch_norm(in_1, in_2, in_3, in_4, in_5)
          tuple_get_item_node = bn_node[0]
          relu_node = relay.nn.relu(tuple_get_item_node)
          bn_relu = relay.Function(
              [in_1, in_2, in_3, in_4, in_5], relu_node
          )
          bn_relu = bn_relu.with_attr("Composite", "bn_relu")
          bn_relu = bn_relu.with_attr(
              "PartitionedFromPattern",
              "nn.batch_norm_TupleGetItem0_nn.relu_",
          )
  
          # merged function
          r = relay.Call(
              bn_relu, [x, gamma, beta, moving_mean, moving_var]
          )
          return relay.Function(
              [x, gamma, beta, moving_mean, moving_var], r
          )
  
      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 16 for calling a global function with example usage: test_tuple_get_item_merge() and returns: relay, relay