code: def test_conv_pool_dense():
      """Make sure that qnn_legalize.py is able to detect and remove empty output channels from a
      convolution -> avg_pool2d -> dense pattern by folding them into a bias_add op.
      """
  
      original = make_test_conv_pool_dense()
  
      with TempOpAttr("nn.bias_add", "FTVMLegalize", legalize_bias_add):
          unoptimized = run_opt_pass(original, transform.InferType())
          optimized = run_opt_pass(original, transform.Legalize())
  
      # Inputs and outputs should be unmodified by channel stripping
      assert unoptimized.checked_type == optimized.checked_type
  
      # Make sure 2/4 channels were removed by channel stripping
      assert tuple(
          unoptimized.body.args[0].args[0].checked_type.shape
      ) == (1, 4)
      assert tuple(
          optimized.body.args[0].args[0].checked_type.shape
      ) == (1, 2)
  
      # Make sure optimized and unoptimized versions behave identically
      np.random.seed(12402)  # Fix seed for repeatability
      input_data = np.random.randint(
          -128, 128, size=(1, 3, 3, 4), dtype="int8"
      )
  
      unoptimized_output = execute_relay_func(
          unoptimized, np.copy(input_data)
      )
      optimized_output = execute_relay_func(
          optimized, np.copy(input_data)
      )
      np.testing.assert_array_equal(
          unoptimized_output, optimized_output
      )
  
file_path: tvm/tests/python/relay/qnn/test_qnn_channel_stripping.py
imports: import numpy
  import tvm
  from tvm import nd, relay
  from tvm.relay import transform
  from tvm.relay.testing.temp_op_attr import TempOpAttr
  from tvm.testing.aot import generate_ref_data
  from tvm.topi.arm_cpu.qnn_legalize import legalize_bias_add
label_desc: Use image node_id 7 for calling a global function with example usage: test_conv_pool_dense() without return types