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

    input -> mod -> batch_norm -> relu -> output

    where mod is a module with a weight associated with it, such as convolution and linear.
    """
    return [
        # conv module + bn module + relu func/module
        *[
            _BackendPatternConfig(get_fusion_pattern((act, (bn_mod, mod))))
            .set_dtype_configs(weighted_dtype_configs)
            .set_fuser_method(get_fuser_method(fused_mod))
            .set_fused_module(fused_mod)
            for act in [_nn.ReLU, _F.relu]
        ],
        # conv + bn + relu fused
        fused_mod_config(
            mod=mod, fused_mod=fused_mod, qat_mod=qat_mod, ref_quant_mod=ref_quant_mod
        ),
        # qat conv + bn + relu
        qat_mod_config(mod=mod, qat_mod=qat_mod, ref_quant_mod=ref_quant_mod),
    ]

    Returns backend pattern configs for the following sequence of ops:

    input -> mod -> batch_norm -> relu -> 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