code: def test_quantize_gluon_with_forward():
      def check_quantize_net(qdtype):
          if is_test_for_native_cpu():
              print(
                  "skipped testing test_quantize_model_with_forward for native cpu since it is not supported yet"
              )
              return
          elif is_test_for_gpu():
              print(
                  "skipped testing test_quantize_model_with_forward for gpu uint8 since it is not supported yet"
              )
              return
  
          data_shape = (32, 3, 224, 224)
          batch_size = 1
          resnet18_v1 = vision.resnet18_v1(pretrained=True)
          resnet18_v1.reset_device(mx.current_device())
          excluded_names_match = []
          if mx.current_device() == mx.gpu():
              excluded_names_match += ["activation", "relu", "conv0"]
          num_calib_batches = 1
  
          random_data = mx.np.random.uniform(size=data_shape)
          calib_data = mx.gluon.data.DataLoader(
              random_data, batch_size=batch_size
          )
  
          quantized_resnet18_v1 = mx.contrib.quant.quantize_net(
              resnet18_v1,
              quantized_dtype=qdtype,
              exclude_layers=None,
              exclude_layers_match=excluded_names_match,
              calib_mode="none",
              data_shapes=[data_shape],
              device=mx.current_device(),
          )
          quantized_resnet18_v1.hybridize(
              static_alloc=True, static_shape=True
          )
          quantized_resnet18_v1(random_data)
  
          for mode in ["naive", "entropy"]:
              for quantize_granularity in [
                  "tensor-wise",
                  "channel-wise",
              ]:
                  qdtype = qdtype if mode == "naive" else "auto"
                  quantized_resnet18_v1 = mx.contrib.quant.quantize_net(
                      resnet18_v1,
                      quantized_dtype=qdtype,
                      exclude_layers=None,
                      exclude_layers_match=excluded_names_match,
                      calib_data=calib_data,
                      calib_mode=mode,
                      quantize_granularity=quantize_granularity,
                      num_calib_batches=num_calib_batches,
                      device=mx.current_device(),
                  )
  
                  quantized_resnet18_v1.hybridize(
                      static_alloc=True, static_shape=True
                  )
                  quantized_resnet18_v1(random_data)
  
      for qdtype in ["int8", "uint8"]:
          check_quantize_net(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 24 for calling a global function with example usage: test_quantize_gluon_with_forward() without return types