code: def test_attach_config_simple_model_weight_threshold_range_test(
      simple_model,
  ):
      custom_config = {
          nn.Conv2d: [
              {"n_bits": 4, "cluster_dim": 4, "weight_threshold": 1000},
              {"n_bits": 2, "cluster_dim": 2, "weight_threshold": 400},
          ]
      }
      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.conv1,
          custom_config[nn.Conv2d][1]["n_bits"],
          custom_config[nn.Conv2d][1]["cluster_dim"],
      )
      _assert_changes_post_attach(
          simple_model.conv2,
          custom_config[nn.Conv2d][0]["n_bits"],
          custom_config[nn.Conv2d][0]["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 7 for calling a global function with example usage: test_attach_config_simple_model_weight_threshold_range_test(simple_model) without return types