def fused_mod_config(
    mod: _Type[_nn.Module],
    fused_mod: _Type[_nn.Module],
    qat_mod: _Type[_nn.Module],
    ref_quant_mod: _Type[_nn.Module],
    input_output_observed: _Optional[bool] = None,
) -> _BackendPatternConfig:
    """
    Returns backend pattern config for fused modules.
    """
    config = (
        _BackendPatternConfig(fused_mod)
        .set_observation_type(_ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT)
        .set_dtype_configs(weighted_dtype_configs)
        .set_root_module(mod)
        .set_qat_module(qat_mod)
        .set_reference_quantized_module(ref_quant_mod)
    )
    if input_output_observed is not None:
        if _is_torch_2():
            config.set_observation_type(_ObservationType.INPUT_OUTPUT_NOT_OBSERVED)
        else:
            config._input_output_observed = False
    return config

    Returns backend pattern config for fused modules.
    
coremltools/optimize/torch/quantization/_backend_config_utils.py