class_docstr: QNN dense op test class.
docstr: Check lowering of qnn.dense + bias_add + qnn.requantize
  dtype: type of weights
  n_dim: N dimension of weights, need to check cases when it is multiple of 32 and not.
docstr_tok: ["Check","lowering","of","qnn.dense","+","bias_add","+","qnn.requantize","dtype",":","type","of","weights","n_dim",":","N","dimension","of","weights",",","need","to","check","cases","when","it","is","multiple","of","32","and","not","."]
code: def test_qnn_dense_biasadd_requantize(
      self, hexagon_session: Session, dtype, n_dim
  ):
      """Check lowering of qnn.dense + bias_add + qnn.requantize
      dtype: type of weights
      n_dim: N dimension of weights, need to check cases when it is multiple of 32 and not.
      """
      data_shape = [128, 32]
      weight_shape = [n_dim, 32]
      bias_shape = [n_dim]
      data = relay.var("data", shape=data_shape, dtype="uint8")
      weight = relay.var("weight", shape=weight_shape, dtype=dtype)
      bias = relay.var("bias", shape=bias_shape, dtype="int32")
  
      op0 = relay.qnn.dense(
          data,
          weight,
          input_zero_point=relay.const(2),
          kernel_zero_point=relay.const(0),
          input_scale=relay.const(0.08),
          kernel_scale=relay.const(0.07),
          units=None,
      )
      op1 = relay.nn.bias_add(op0, bias)
      op2 = relay.qnn.requantize(
          op1,
          input_scale=relay.const(1.3),
          input_zero_point=relay.const(4),
          output_scale=relay.const(3.7),
          output_zero_point=relay.const(1),
          out_dtype="uint8",
      )
      relay_mod = tvm.IRModule.from_expr(op2)
  
      np.random.seed(0)
  
      inputs = {
          "data": np.random.randint(
              2, 8, size=data_shape, dtype="uint8"
          ),
          "weight": np.random.randint(
              0, 8, size=weight_shape, dtype=dtype
          ),
          "bias": np.random.randint(
              -10, 10, size=bias_shape, dtype="int32"
          ),
      }
  
      run_and_compare(hexagon_session, relay_mod, inputs, atol=1)
  
imports: import numpy
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay
  from tvm.contrib.hexagon.session import Session
  from tvm.contrib.hexagon.pytest_plugin import HEXAGON_AOT_LLVM_TARGET
  from tvm.relay.backend import Executor
  from tvm.relay.testing import run_opt_pass, run_infer_type
  from .infrastructure import quantize_np
label_desc: Use image node_id 2 for calling the TestQnnDense obj's underlying member method code with example usage: obj.test_qnn_dense_biasadd_requantize(hexagon_session, dtype, n_dim) without return types