def weighted_configs(
    mod: _Type[_nn.Module],
    func_mod: _Optional[_Callable],
    qat_mod: _Type[_nn.Module],
    ref_quant_mod: _Type[_nn.Module],
    input_output_observed: _Optional[bool] = None,
) -> _List[_BackendPatternConfig]:
    """
    Returns backend pattern configs for modules which have a weight associated with them,
    such as convolution, linear, embedding, etc.
    """
    configs = [
        # conv/linear module
        fused_mod_config(
            mod=mod,
            fused_mod=mod,
            qat_mod=qat_mod,
            ref_quant_mod=ref_quant_mod,
            input_output_observed=input_output_observed,
        ),
        # qat conv/linear
        qat_mod_config(mod=mod, qat_mod=qat_mod, ref_quant_mod=ref_quant_mod),
    ]
    if func_mod is not None:
        configs += [
            # functional
            _BackendPatternConfig(func_mod)
            .set_observation_type(_ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT)
            .set_dtype_configs(weighted_dtype_configs)
            ._set_input_type_to_index({"weight": 1, "bias": 2}),
        ]
    return configs

    Returns backend pattern configs for modules which have a weight associated with them,
    such as convolution, linear, embedding, etc.
    
coremltools/optimize/torch/quantization/_backend_config_utils.py