code: def test_dequantize_int8_to_float32():
      def get_test_data(real_range, qdata_np):
          qdata = mx.nd.array(qdata_np, dtype=onp.int8)
          min_range = mx.nd.array([-real_range], dtype=onp.float32)
          max_range = mx.nd.array([real_range], dtype=onp.float32)
          return qdata, min_range, max_range
  
      def baseline_dequantization(qdata, real_range, qdata_np):
          quantized_range = 127.0
          scale = real_range / quantized_range
          data_np = qdata_np * scale
          return data_np
  
      def test_nd_array_dequantization(
          qdata, min_range, max_range, expected_result
      ):
          data = mx.nd.contrib.dequantize(
              qdata, min_range, max_range, out_type="float32"
          )
          assert data.dtype == onp.float32
          assert_almost_equal(data.asnumpy(), expected_result, atol=1)
  
      def test_symbolic_api_dequantization(
          qdata, min_range, max_range, expected_result
      ):
          sym_data = mx.sym.Variable("data")
          sym_min_range = mx.sym.Variable("min_range")
          sym_max_range = mx.sym.Variable("max_range")
          dequant = mx.sym.contrib.dequantize(
              sym_data, sym_min_range, sym_max_range, out_type="float32"
          )
          out = dequant._bind(
              ctx=mx.current_device(),
              args={
                  "data": qdata,
                  "min_range": min_range,
                  "max_range": max_range,
              },
          )
          data = out.forward()[0]
          assert data.dtype == onp.float32
          assert_almost_equal(data.asnumpy(), expected_result, atol=1)
  
      real_range = 128
      shape = rand_shape_nd(4)
      qdata_np = onp.random.uniform(
          low=-127, high=127, size=shape
      ).astype(dtype=onp.int8)
      qdata, min_range, max_range = get_test_data(real_range, qdata_np)
      expected_result = baseline_dequantization(
          qdata, real_range, qdata_np
      )
      # test nd array implementation.
      test_nd_array_dequantization(
          qdata, min_range, max_range, expected_result
      )
      # test symbolic api implementaion.
      test_symbolic_api_dequantization(
          qdata, min_range, max_range, expected_result
      )
  
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 8 for calling a global function with example usage: test_dequantize_int8_to_float32() and returns: qdata,  min_range,  max_range, data_np