code: def test_quantized_elemwise_add():
      def check_quantized_elemwise_add(data_shape, qdtypeA, qdtypeB):
          if is_test_for_native_cpu():
              print(
                  "skipped testing quantized_elemwise_add for native cpu since it is not supported yet"
              )
              return
          elif (qdtypeA != "uint8" and qdtypeA != "int8") or (
              qdtypeB != "uint8" and qdtypeB != "int8"
          ):
              print(
                  "skipped testing quantized_elemwise_add for not supported data type"
              )
              return
          elif is_test_for_gpu():
              print(
                  "skipped testing quantized_elemwise_add for gpu since it is not supported yet"
              )
              return
  
          class ElemwiseSumBlock(mx.gluon.nn.HybridBlock):
              def __init__(self, **kwargs):
                  super(ElemwiseSumBlock, self).__init__(**kwargs)
  
              def forward(self, dataA, dataB):
                  return dataA + dataB
  
          class QuantElemwiseSumBlock(mx.gluon.nn.HybridBlock):
              def __init__(self, **kwargs):
                  super(QuantElemwiseSumBlock, self).__init__(**kwargs)
  
              def forward(
                  self,
                  dataA,
                  dataB,
                  dataA_min,
                  dataA_max,
                  dataB_min,
                  dataB_max,
              ):
                  return npx.quantized_elemwise_add(
                      dataA,
                      dataB,
                      dataA_min,
                      dataA_max,
                      dataB_min,
                      dataB_max,
                  )
  
          elemwise_add_fp32 = ElemwiseSumBlock()
  
          dataA_low, dataA_high = get_low_high(qdtypeA)
          dataB_low, dataB_high = get_low_high(qdtypeB)
  
          dataA_val = (
              mx.np.random.uniform(
                  low=dataA_low, high=dataA_high, size=data_shape
              )
              .astype("int32")
              .astype("float32")
          )
          dataB_val = (
              mx.np.random.uniform(
                  low=dataB_low, high=dataB_high, size=data_shape
              )
              .astype("int32")
              .astype("float32")
          )
  
          output = elemwise_add_fp32(dataA_val, dataB_val)
          mx.nd.waitall()
  
          # run quantized
          quantized_elemwise_add = QuantElemwiseSumBlock()
          dataA_val_int8 = dataA_val.astype(qdtypeA)
          dataB_val_int8 = dataB_val.astype(qdtypeB)
  
          quantized_range = 127.0
          min_dataA = mx.np.array([dataA_low])
          max_dataA = mx.np.array([dataA_high])
          min_dataB = mx.np.array([dataB_low])
          max_dataB = mx.np.array([dataB_high])
          qoutput, min_range, max_range = quantized_elemwise_add(
              dataA_val_int8,
              dataB_val_int8,
              min_dataA,
              max_dataA,
              min_dataB,
              max_dataB,
          )
          int8_rslt = (
              qoutput.astype(output.dtype) * max_range / 0x7FFFFFFF
          )
          diff = mx.np.abs(output - int8_rslt)
          cond = mx.np.less(2, diff).sum().item()
          assert cond == 0
  
      check_quantized_elemwise_add((4, 6), "uint8", "int8")
      check_quantized_elemwise_add((13, 74, 52), "uint8", "uint8")
      check_quantized_elemwise_add((3, 4, 56, 56), "int8", "uint8")
      check_quantized_elemwise_add((32, 56, 64, 11), "int8", "int8")
  
imports: import os
  import mxnet
  import numpy
  from mxnet import npx
  from mxnet.util import use_np
  from mxnet.gluon.model_zoo import vision
  from mxnet.test_utils import assert_almost_equal, assert_exception, rand_ndarray, rand_shape_nd, same, DummyIter
  from common import xfail_when_nonstandard_decimal_separator
  from mxnet.io import NDArrayIter
  import unittest
  import operator
label_desc: Use image node_id 11 for calling a global function with example usage: test_quantized_elemwise_add() and returns: unknown, npx