def test_attach_config_only_on_specified_modules_conv(simple_model):
    """
    If there is a module type specified in the palettization_config, qconfigs should only be applied to modules of
    those types not to modules of other type. For eg: If palettization_config only contains Conv2d, we should
    not attach a qconfig to nn.Linear despite it being supported by palettization.
    """
    custom_config = {nn.Conv2d: {"n_bits": 2, "cluster_dim": 2}}
    config = DKMPalettizerConfig.from_dict({"module_type_configs": custom_config})
    palettizer = DKMPalettizer(simple_model, config)
    palettizer.prepare(inplace=True)

    # For the below assertion, prepare_qat would propagate a None qconfig throughout the supported modules in
    # the model
    assert hasattr(simple_model.fc1, "qconfig") and simple_model.fc1.qconfig is None
    _assert_changes_post_attach(
        simple_model.conv2,
        custom_config[nn.Conv2d]["n_bits"],
        custom_config[nn.Conv2d]["cluster_dim"],
    )

    If there is a module type specified in the palettization_config, qconfigs should only be applied to modules of
    those types not to modules of other type. For eg: If palettization_config only contains Conv2d, we should
    not attach a qconfig to nn.Linear despite it being supported by palettization.
    
coremltools/test/optimize/torch/palettization/test_palettization_api.py