code: def calibrate(dataset=None):
      """The calibrate procedure will try to calculate the content of
      dom_scale, nbit, clip_min, clip_max for every `simulated_quantize`
      operator.
  
      Parameters
      ---------
      dataset: Optional[Iterable[NDArray]]
          The calibration dataset.
  
      Returns
      -------
      ret: Function
          The module pass function.
      """
  
      def wrapped_func(mod, _):
          """make transform.module pass happy"""
          cfg = quantize.current_qconfig()
  
          if cfg.calibrate_mode == "kl_divergence":
              input_scale_func = _kl_scale(mod, dataset)
          elif cfg.calibrate_mode == "global_scale":
              input_scale_func = _global_scale
          elif cfg.calibrate_mode == "percentile":
              input_scale_func = _percentile_scale(mod, dataset)
          else:
              raise ValueError(
                  f"Unknown calibrate mode {cfg.calibrate_mode}"
              )
  
          if cfg.weight_scale == "max":
              weight_scale_func = _max_scale
          elif cfg.weight_scale == "power2":
              weight_scale_func = _power2_scale
          else:
              raise ValueError(
                  f"Unknown weight scale mode {cfg.weight_scale}"
              )
  
          return _set_params(mod, input_scale_func, weight_scale_func)
  
      return wrapped_func
  
imports: from __future__ import absolute_import
  import logging
  import multiprocessing
  import numpy
  import tvm
  import tvm.driver
  from tvm.ir import IRModule
  from .None import _quantize
  from .None import quantize
  from ..None import op
  from ..None import expr
  from ..None import analysis
  from ..None import build_module
  from ...contrib import graph_executor
  from .kl_divergence import _find_scale_by_kl
label_desc: Use image node_id 10 for calling a global function with example usage: calibrate(dataset) and returns: wrapped_func, _set_params