class_docstr: Test quantize class.
docstr: Test quantize.
code: def test_quantize(
      self,
      input_dtype,
      output_dtype,
      transformed_input_np,
      input_shape,
      expected_output_np,
      transformed_expected_output_np,
      input_crouton_layout,
      output_layout,
      hexagon_session,
  ):
      """Test quantize."""
      a_tensor = te.placeholder(
          input_shape, name="a_tensor", dtype=input_dtype
      )
  
      m_tensor = s1.quantize_compute(
          a_tensor, QUANTIZE_SCALE, QUANTIZE_ZERO_POINT, output_dtype
      )
  
      tir_schedule = s1.tir_quantize_schedule(
          m_tensor, a_tensor, input_crouton_layout, output_layout
      )
  
      sch = tir_schedule.mod
  
      input_axis_separator = [4]
      output_axis_separator = [4]
  
      with tvm.transform.PassContext(opt_level=3):
          func = tvm.build(
              sch,
              [a_tensor, m_tensor],
              get_hexagon_target("v69"),
              name="quantize",
          )
  
      a_data_nd = allocate_hexagon_array(
          hexagon_session.device,
          data=transformed_input_np,
          dtype=input_dtype,
          axis_separators=input_axis_separator,
          mem_scope="global.vtcm",
      )
  
      m_data_nd = allocate_hexagon_array(
          hexagon_session.device,
          tensor_shape=transformed_expected_output_np.shape,
          dtype=output_dtype,
          axis_separators=output_axis_separator,
          mem_scope="global.vtcm",
      )
  
      mod = hexagon_session.load_module(func)
      mod(a_data_nd, m_data_nd)
  
      b, h, weight, c = expected_output_np.shape
  
      # convert nd to np and reshape to fixed chunk size layout
      m_data_np = m_data_nd.numpy().reshape(
          [b, h // 8, weight // 8, c // 32, 8, 8, 32]
      )
  
      np.testing.assert_allclose(
          transformed_expected_output_np, m_data_np, atol=1
      )
  
file_path: tvm/tests/python/contrib/test_hexagon/topi/test_quantize.py
imports: import numpy
  import tvm
  from tvm import te
  import tvm.topi.hexagon.qnn
  from tvm.contrib.hexagon import allocate_hexagon_array
  from ..infrastructure import transform_numpy, quantize_np, get_hexagon_target
label_desc: Use image node_id 5 for calling the TestQuantize obj's underlying member method code with example usage: obj.test_quantize(input_dtype, output_dtype, transformed_input_np, input_shape, expected_output_np, transformed_expected_output_np, input_crouton_layout, output_layout, hexagon_session) without return types