code: def _quantize_params(qsym, params, min_max_dict):
      """Given a quantized symbol and a dict of params that have not been quantized,
      generate quantized params. Currently only supports quantizing the arg_params
      with names of `weight` or `bias`, not aux_params. If `qsym` contains symbols
      that are excluded from being quantized, their corresponding params will
      not be quantized, but saved together with quantized params of the symbols that
      have been quantized.
  
      Parameters
      ----------
      qsym : Symbol
          Quantized symbol from FP32 symbol.
      params : dict of str->NDArray
      min_max_dict : dict of min/max pairs of layers' output
      """
      inputs_name = qsym.list_arguments()
      quantized_params = {}
      if is_np_array():
          quantize_fn = mx.npx.contrib_quantize
          min_fn = lambda arr: mx.np.array([mx.np.min(arr)])
          max_fn = lambda arr: mx.np.array([mx.np.max(arr)])
          array_cls = mx.np
      else:
          quantize_fn = mx.nd.contrib.quantize
          min_fn = mx.nd.min
          max_fn = mx.nd.max
          array_cls = mx.nd
  
      for name in inputs_name:
          if name.endswith(("weight_quantize", "bias_quantize")):
              original_name = name[: -len("_quantize")]
              param = params[original_name]
              # pylint: disable=unbalanced-tuple-unpacking
              param_min = min_fn(param)
              param_max = max_fn(param)
              val, vmin, vmax = quantize_fn(
                  data=param,
                  min_range=param_min,
                  max_range=param_max,
                  out_type="int8",
              )
              quantized_params[name] = val
              quantized_params[name + "_min"] = vmin
              quantized_params[name + "_max"] = vmax
          elif name in params:
              quantized_params[name] = params[name]
          elif name.endswith(("_min")):
              output = name[: -len("_min")]
              if output in min_max_dict:
                  quantized_params[name] = array_cls.array(
                      [min_max_dict[output][0]]
                  )
          elif name.endswith(("_max")):
              output = name[: -len("_min")]
              if output in min_max_dict:
                  quantized_params[name] = array_cls.array(
                      [min_max_dict[output][1]]
                  )
      return quantized_params
  
imports: import abc
  import ctypes
  import logging
  import os
  import warnings
  import numpy
  import mxnet
  from ..base import _LIB, check_call, py_str
  from ..base import c_array, c_str, mx_uint, mx_real_t, c_str_array
  from ..base import SymbolHandle
  from ..symbol import Symbol
  from ..None import ndarray
  from ..io import DataDesc
  from ..device import cpu, Device
  from ..util import is_np_array, wrap_ctx_to_device_func
label_desc: Use image node_id 2 for calling a global function with example usage: _quantize_params(qsym, params, min_max_dict) and returns: quantized_params