def _map_smooth_quant_info_to_idx(module):
    """
    Map dict of {tensor id: smooth quant scaling factor} to
        dict of {idx: smooth quant scaling factor}.
    For nn.Linear module only.
    """
    if not hasattr(module, "_auto_quant_state"):
        return
    qstate: AutoQuantizationState = module._auto_quant_state  # type: ignore[assignment]
    qconfig = qstate.qconfig
    if not isinstance(
        qconfig.activation(), SmoothQuantActivationObserver
    ) or not isinstance(qconfig.weight(), SmoothQuantWeightObserver):
        return
    for _, seen_q_op_info in qstate.idx_to_seen_q_op_infos.items():
        if not seen_q_op_info.input_tensor_infos:
            continue
        # Linear has only one activation
        for input_arg in seen_q_op_info.input_tensor_infos:
            if input_arg is None:
                continue
            tensor_id = str(input_arg.id)
            if tensor_id in qstate.tensor_id_to_smooth_quant_scaling_factor:
                key = str(seen_q_op_info.idx)
                qstate.idx_to_smooth_quant_scaling_factor[key] = (
                    qstate.tensor_id_to_smooth_quant_scaling_factor[tensor_id]
                )
        # Linear has only one weight. Key is not changed.
        for weight_arg in seen_q_op_info.weight_tensor_infos:
            if weight_arg is None:
                continue
            tensor_id = str(seen_q_op_info.idx) + "_" + str(weight_arg.id)
            if tensor_id in qstate.weight_tensor_id_to_smooth_quant_scaling_factor:
                key = str(seen_q_op_info.idx) + "_" + str(weight_arg.id)
                qstate.idx_to_smooth_quant_scaling_factor[key] = (
                    qstate.weight_tensor_id_to_smooth_quant_scaling_factor[tensor_id]
                )

    Map dict of {tensor id: smooth quant scaling factor} to
        dict of {idx: smooth quant scaling factor}.
    For nn.Linear module only.
    
intel_extension_for_pytorch/quantization/_utils.py