code: def get_weight_quant_params(script_module, packed_param_names):
      """Retrieve and unpack weight parameters from quantized modules"""
      import torch
  
      param_name = "_packed_params"
      quant_params = {}
  
      def filter_func(named_module):
          m = named_module[1]
          return isinstance(m, torch.jit.RecursiveScriptModule) and (
              ("Conv" in m.original_name)
              or (m.original_name == "LinearPackedParams")
          )
  
      for name, m in filter(filter_func, script_module.named_modules()):
          key = name + "." + param_name
          state_dict = m.state_dict()
  
          if key not in packed_param_names:
              continue
  
          if len(state_dict) == 0 and not hasattr(m, param_name):
              # for v1.6 and above
              # This case seems to happen if a model is serialized
              # and loaded back
              # This module can be safely ignored
              continue
  
          if len(state_dict) == 0 and hasattr(m, param_name):
              # for v1.6 and above
              packed_params = m._packed_params
          else:
              assert len(state_dict) == 1
              packed_params = list(state_dict.values())[0]
  
          if "Conv" in m.original_name and len(state_dict) == 0:
              qweight, bias = torch.ops.quantized.conv2d_unpack(
                  packed_params
              )
              quant_params[key] = make_conv_packed_param(
                  qweight, bias, packed_params
              )
          elif "Conv" in m.original_name:
              qweight, bias = torch.ops.quantized.conv2d_unpack(
                  packed_params
              )
              quant_params[key] = make_qnn_param(qweight, bias)
          elif m.original_name == "LinearPackedParams":
              qweight, bias = torch.ops.quantized.linear_unpack(
                  packed_params
              )
              quant_params[key] = make_qnn_param(qweight, bias)
  
      return quant_params
  
imports: import numpy
  import tvm
  from tvm import relay
  from tvm.relay import expr
  from tvm.relay import op
  from tvm.relay.frontend.common import infer_shape
  from .common import logger
  from .pytorch_utils import is_version_greater_than
label_desc: Use image node_id 4 for calling a global function with example usage: get_weight_quant_params(script_module, packed_param_names) and returns: quant_params, unknown