code: def test_quantized_act():
      def check_quantized_act(data_shape, qdtype):
          if is_test_for_native_cpu():
              print(
                  "skipped testing quantized_act for native cpu since it is not supported yet"
              )
              return
          elif qdtype == "int8" and is_test_for_dnnl():
              print(
                  "skipped testing quantized_act for oneDNN cpu int8 since it is not supported yet"
              )
              return
          elif is_test_for_gpu():
              print(
                  "skipped testing quantized_act for gpu since it is not supported yet"
              )
              return
  
          act_fp32 = mx.gluon.nn.Activation(activation="relu")
  
          if qdtype == "uint8":
              data_low = 0.0
              data_high = 127.0
          else:
              data_low = -127.0
              data_high = 127.0
  
          data = (
              mx.np.random.uniform(
                  low=data_low, high=data_high, size=data_shape
              )
              .astype(qdtype)
              .astype("float32")
          )
          output = act_fp32(data)
  
          class QuantActivation(mx.gluon.nn.HybridBlock):
              def __init__(self, activation, **kwargs):
                  super(QuantActivation, self).__init__(**kwargs)
                  self._kwargs = {"act_type": activation}
  
              def forward(self, x, min_data, max_data):
                  out = npx.quantized_act(
                      data=x,
                      min_data=min_data,
                      max_data=max_data,
                      **self._kwargs,
                  )
                  return out
  
          quantized_act = QuantActivation(activation="relu")
  
          qdata = data.astype(qdtype)
          quantized_range_min = mx.np.array(
              [mx.np.min(data).astype("float32").item()]
          )
          quantized_range_max = mx.np.array(
              [mx.np.max(data).astype("float32").item()]
          )
          qoutput, min_range, max_range = quantized_act(
              qdata, quantized_range_min, quantized_range_max
          )
  
          assert_almost_equal(output.asnumpy(), qoutput.asnumpy())
          assert_almost_equal(
              min_range.item(), quantized_range_min.item()
          )
          assert_almost_equal(
              max_range.item(), quantized_range_max.item()
          )
  
      for qdtype in ["int8", "uint8"]:
          check_quantized_act((10,), qdtype)
          check_quantized_act((10, 15), qdtype)
          check_quantized_act((10, 15, 18), qdtype)
          check_quantized_act((3, 4, 23, 23), qdtype)
  
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 19 for calling a global function with example usage: test_quantized_act() and returns: out