code: def test_weight_palettization_unique_case_1():
      # In this model, both conv weights can be palettized
      (
          model,
          inputs,
          torch_input_values,
          coreml_input_values,
      ) = get_test_model_and_data(multi_layer=True)
  
      weight_1_unique = create_unique_weight(
          model.conv_1.weight, nbits=2
      )
      weight_2_unique = create_unique_weight(
          model.conv_2.weight, nbits=6
      )
  
      with torch.no_grad():
          model.conv_1.weight = torch.nn.Parameter(
              torch.Tensor(weight_1_unique)
          )
          model.conv_2.weight = torch.nn.Parameter(
              torch.Tensor(weight_2_unique)
          )
  
      torchmodel = torch.jit.trace(model, torch_input_values)
      mlmodel = ct.convert(
          torchmodel, inputs=inputs, convert_to="mlprogram"
      )
  
      # validate parameters
      mlmodel_palettized = palettize_weights(mlmodel, mode="unique")
      expected_ops = [
          "constexpr_lut_to_dense",
          "cast",
          "conv",
          "constexpr_lut_to_dense",
          "conv",
          "cast",
      ]
      assert (
          get_op_types_in_program(mlmodel_palettized._mil_program)
          == expected_ops
      )
  
      main_func = mlmodel_palettized._mil_program.functions["main"]
      lut_to_dense_op_1 = main_func.find_ops(
          op_type="constexpr_lut_to_dense"
      )[0]
      lut_to_dense_op_2 = main_func.find_ops(
          op_type="constexpr_lut_to_dense"
      )[1]
  
      assert lut_to_dense_op_1.shape.val.tolist() == list(
          model.conv_1.weight.detach().numpy().shape
      )
      assert lut_to_dense_op_2.shape.val.tolist() == list(
          model.conv_2.weight.detach().numpy().shape
      )
  
      # validate the model
      verify_model_outputs(
          mlmodel, mlmodel_palettized, coreml_input_values
      )
  
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 3 for calling the TestPalettizeWeights obj's underlying member method code with example usage: obj.test_weight_palettization_unique_case_1() without return types