code: def test_mkldnn_quantize():
      def quantize_test_driver(
          out_dtype, quant_args, in_data, verify_output_data
      ):
          shape = in_data.shape
          input_data = relay.var(
              "input_data", shape=shape, dtype="float32"
          )
          min_range = quant_args["min_range"]
          max_range = quant_args["max_range"]
          quantized_output, _, _ = quantize_mxnet_min_max(
              input_data,
              min_range=min_range,
              max_range=max_range,
              out_dtype=out_dtype,
          )
          mod = relay.Function(
              relay.analysis.free_vars(quantized_output),
              quantized_output,
          )
          mod = tvm.IRModule.from_expr(mod)
          with tvm.transform.PassContext(opt_level=3):
              graph, lib, params = relay.build(mod, "llvm", params=None)
              rt_mod = graph_executor.create(
                  graph, lib, device=tvm.cpu(0)
              )
              rt_mod.set_input(input_data=in_data)
              rt_mod.set_input(**params)
              rt_mod.run()
              res = rt_mod.get_output(0).numpy()
              assert np.allclose(res, verify_output_data)
              assert res.dtype == verify_output_data.dtype
  
      def test_float32_to_uint8():
          data = (
              np.array(
                  [
                      0.0,
                      0.25048923,
                      0.50097847,
                      0.7514677,
                      1.0019569,
                      62.8728,
                      63.123287,
                      63.373775,
                      63.624268,
                      63.874756,
                  ]
              )
              .astype("float32")
              .reshape((2, 5))
          )
          output = (
              np.array([0, 1, 2, 3, 4, 251, 252, 253, 254, 255])
              .astype("uint8")
              .reshape((2, 5))
          )
  
          quant_args = {"min_range": -63.5, "max_range": 64}
          quantize_test_driver(
              out_dtype="uint8",
              quant_args=quant_args,
              in_data=data,
              verify_output_data=output,
          )
  
      def test_float32_to_int8():
          data = (
              np.array(
                  [
                      -63.247063,
                      -62.745102,
                      -62.24314,
                      -61.74118,
                      -61.23922,
                      61.74118,
                      62.24314,
                      62.745102,
                      63.247063,
                      63.749023,
                  ]
              )
              .astype("float32")
              .reshape((2, 5))
          )
          output = (
              np.array(
                  [
                      -126,
                      -125,
                      -124,
                      -123,
                      -122,
                      123,
                      124,
                      125,
                      126,
                      127,
                  ]
              )
              .astype("int8")
              .reshape((2, 5))
          )
  
          quant_args = {"min_range": -63.5, "max_range": 64}
          quantize_test_driver(
              out_dtype="int8",
              quant_args=quant_args,
              in_data=data,
              verify_output_data=output,
          )
  
      test_float32_to_uint8()
      test_float32_to_int8()
  
file_path: tvm/tests/python/frontend/mxnet/test_qnn_ops_utils.py
imports: import numpy
  import tvm
  from tvm import relay
  from tvm.contrib import graph_executor
  from tvm.relay.frontend.mxnet_qnn_op_utils import dequantize_mxnet_min_max, quantize_mxnet_min_max, get_mkldnn_int8_scale, get_mkldnn_uint8_scale, quantize_conv_bias_mkldnn_from_var
label_desc: Use image node_id 2 for calling a global function with example usage: test_mkldnn_quantize() without return types