code: def quantize(mod, params=None, dataset=None):
      """The quantization procedure. Before running the three main
      procedure of quantization, "annotate", "calibrate" and "realize"
      , we need to do "SimplifyInference", "FoldScaleAxis", "FoldConstant"
      first for optimizing.
  
      Parameters
      ---------
      mod: Module
          The original module.
  
      params : dict of str to NDArray
          Input parameters to the graph that do not change
          during inference time. Used for constant folding.
  
      dataset: list of dict of Var -> NDArray
          The calibration dataset.
  
      Returns
      -------
      ret: Function
          The graph after quantization
      """
      mod = prerequisite_optimize(mod, params)
  
      calibrate_pass = tvm.transform.module_pass(
          calibrate(dataset), opt_level=1, name="QuantizeCalibrate"
      )
      quant_passes = [
          partition(),
          annotate(),
          calibrate_pass,
          tvm.relay.transform.InferType(),
      ]
      if not current_qconfig().do_simulation:
          quant_passes.append(realize())
      quant_passes.append(_transform.FoldConstant())
      quantize_seq = tvm.transform.Sequential(quant_passes)
      with tvm.transform.PassContext(
          opt_level=3,
          required_pass=[
              "QuantizeAnnotate",
              "QuantizeCalibrate",
              "QuantizeRealize",
          ],
      ):
          with quantize_context():
              mod = quantize_seq(mod)
  
      q_cfg = current_qconfig()
      assert q_cfg.partition_conversions in [
          "disabled",
          "enabled",
          "fully_integral",
      ]
      if q_cfg.partition_conversions != "disabled":
          quantized_dtypes = {
              q_cfg.dtype_input,
              q_cfg.dtype_weight,
              q_cfg.dtype_activation,
          }
          ensure_fully_integral = (
              q_cfg.partition_conversions == "fully_integral"
          )
          return partition_conversions(
              mod, quantized_dtypes, ensure_fully_integral
          )
  
      return mod
  
imports: import tvm.ir
  import tvm
  from tvm.runtime import Object
  from .None import _quantize
  from ._calibrate import calibrate
  from ._partition_conversions import partition_conversions
  from ..None import expr
  from ..None import transform
label_desc: Use image node_id 11 for calling a global function with example usage: quantize(mod, params, dataset) and returns: mod, partition_conversions