code: def _set_params(mod, input_scale_func, weight_scale_func):
      quantize_op = _op.get("relay.op.annotation.simulated_quantize")
      cfg = quantize.current_qconfig()
      const_params = {}
  
      def visit_func(expr):
          """visitor function for traverse"""
          if isinstance(expr, _expr.Call) and expr.op == quantize_op:
              _, ndom_scale, nclip_min, nclip_max = expr.args
              attrs = expr.attrs
              kind = attrs.kind
              nbit = cfg.get_nbit_by_kind(kind)
              valid_bit = nbit - attrs.sign
  
              # set scale
              if kind == quantize.QAnnotateKind.WEIGHT:
                  assert isinstance(expr.args[0], _expr.Constant)
                  scale = weight_scale_func(expr)
              else:
                  scale = input_scale_func(expr)
  
              def _make_const(val):
                  return _expr.const(val, "float32")
  
              valid_range = 2**valid_bit
              const_params[ndom_scale] = _make_const(
                  scale / valid_range
              )
              const_params[nclip_min] = _make_const(-(valid_range - 1))
              const_params[nclip_max] = _make_const((valid_range - 1))
  
      main_func = mod["main"]
      _analysis.post_order_visit(main_func, visit_func)
      main_func = _expr.bind(main_func, const_params)
      func_dict = {}
      for global_var, func in mod.functions.items():
          if global_var.name_hint != "main":
              func_dict[global_var] = func
      return IRModule.from_expr(main_func, func_dict)
  
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 6 for calling a global function with example usage: _set_params(mod, input_scale_func, weight_scale_func) and returns: IRModule, _expr