code: 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"],
      )
  
imports: import copy
  import pytest
  import torch
  import torch.functional
  import torch.nn
  from coremltools.optimize.torch.palettization import DKMPalettizer, DKMPalettizerConfig
  from coremltools.optimize.torch.palettization.palettization_config import DEFAULT_PALETTIZATION_SCHEME
  from coremltools.test.optimize.torch.palettization.palettization_utils import _assert_changes_post_attach, _assert_changes_post_prepare
label_desc: Use image node_id 8 for calling a global function with example usage: test_attach_config_only_on_specified_modules_conv(simple_model) without return types