code: def test_weight_decopmression_coreml_optimize():
      (
          model,
          inputs,
          torch_input_values,
          coreml_input_values,
      ) = get_test_model_and_data_complex()
  
      weight_1_sparse = create_sparse_weight(model.conv_1.weight, 0.5)
      weight_2_sparse = create_sparse_weight(model.conv_2.weight, 0.1)
      linear_1_unique = create_unique_weight(
          model.linear_1.weight, nbits=4
      )
  
      with torch.no_grad():
          model.conv_1.weight = torch.nn.Parameter(
              torch.Tensor(weight_1_sparse)
          )
          model.conv_2.weight = torch.nn.Parameter(
              torch.Tensor(weight_2_sparse)
          )
          model.linear_1.weight = torch.nn.Parameter(
              torch.Tensor(linear_1_unique)
          )
  
      torchmodel = torch.jit.trace(model, torch_input_values)
  
      pipeline = ct.PassPipeline.DEFAULT_PRUNING
  
      pipeline.insert_pass(1, "compression::palettize_weights")
      config = cto.coreml.OptimizationConfig(
          global_config=cto.coreml.OpPalettizerConfig(mode="unique"),
      )
      pipeline.set_options(
          "compression::palettize_weights", {"config": config}
      )
  
      mlmodel = ct.convert(
          torchmodel,
          inputs=inputs,
          convert_to="mlprogram",
          pass_pipeline=pipeline,
          compute_precision=ct.precision.FLOAT32,
          minimum_deployment_target=ct.target.iOS16,
      )
  
      decompressed_model = cto.coreml.decompress_weights(mlmodel)
      prog = decompressed_model._mil_program
      op_types = get_op_types_in_program(prog)
      for val in op_types:
          assert "constexpr" not in val
  
      if ct.utils._macos_version() < (13, 0):
          return
  
      # compared the numerical outputs
      output_dict = mlmodel.predict(coreml_input_values)
      de_output_dict = decompressed_model.predict(coreml_input_values)
  
      for k, v in output_dict.items():
          assert k in de_output_dict
          np.testing.assert_allclose(v, de_output_dict[k])
  
imports: import itertools
  import numpy
  import pytest
  import torch
  import coremltools
  import coremltools.optimize
  from coremltools._deps import _HAS_SKLEARN
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.optimize.coreml._post_training_quantization import CoreMLWeightMetaData
  from coremltools.test.ml_program.test_compression import get_test_model_and_data
label_desc: Use image node_id 1 for calling the TestDecompressWeights obj's underlying member method code with example usage: obj.test_weight_decopmression_coreml_optimize() without return types