def weighted_act_configs(
    mod: _Type[_nn.Module],
    func_mod: _Callable,
    act: _Type[_nn.Module],
    fused_mod: _Type[_nn.Module],
    qat_mod: _Type[_nn.Module],
    ref_quant_mod: _Type[_nn.Module],
) -> _List[_BackendPatternConfig]:
    """
    Returns backend pattern configs for the following sequence of ops:

    input -> mod -> activation -> output

    where mod is a module with a weight associated with it, such as convolution and linear.
    """
    return [
        # conv/linear module + act module
        _BackendPatternConfig(get_fusion_pattern((act, mod)))
        .set_dtype_configs(weighted_dtype_configs)
        .set_fuser_method(get_fuser_method(fused_mod))
        .set_fused_module(fused_mod),
        # conv/linear func + act module
        _BackendPatternConfig(get_fusion_pattern((act, func_mod)))
        .set_observation_type(_ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT)
        .set_dtype_configs(weighted_dtype_configs),
        # conv/linear + act fused
        fused_mod_config(
            mod=fused_mod,
            fused_mod=fused_mod,
            qat_mod=qat_mod,
            ref_quant_mod=ref_quant_mod,
        ),
        # qat conv/linear + act
        qat_mod_config(mod=fused_mod, qat_mod=qat_mod, ref_quant_mod=ref_quant_mod),
    ]

    Returns backend pattern configs for the following sequence of ops:

    input -> mod -> activation -> output

    where mod is a module with a weight associated with it, such as convolution and linear.
    
coremltools/optimize/torch/quantization/_backend_config_utils.py