def test_op_type_config_palettizer(self):
        """
        set_op_type allow the user to set different config for each op type.
        Also checking that the config can be overwritten
        """
        conv_config_1 = cto.coreml.OpPalettizerConfig(
            nbits=8,
            mode="KMEANS",
            weight_threshold=2000,
        )
        # conv_config_2 overwrite conv_config_1
        conv_config_2 = cto.coreml.OpPalettizerConfig(
            nbits=2,
            mode="KMEANS",
            weight_threshold=2000,
        )
        linear_config = cto.coreml.OpPalettizerConfig(
            nbits=4,
            mode="UNIFORM",
            weight_threshold=2000,
        )
        # The weight_threshold is super large so conv_transpose is not going to be compressed
        conv_transpose_config = cto.coreml.OpPalettizerConfig(
            nbits=4,
            mode="UNIFORM",
            weight_threshold=1000000,
        )

        config = cto.coreml.OptimizationConfig()
        config.set_op_type("conv", conv_config_1)
        config.set_op_type("conv", conv_config_2)
        config.set_op_type("linear", linear_config)
        config.set_op_type("conv_transpose", conv_transpose_config)

        compressor = quantization.palettize_weights(config=config)

        prog = self._get_test_program()
        compressor.apply(prog)

        expected_ops = [
            "constexpr_lut_to_dense",
            "conv",
            "reshape",
            "constexpr_lut_to_dense",
            "linear",
            "reshape",
            "conv_transpose",
        ]
        assert get_op_types_in_program(prog) == expected_ops

        # Test different nbits are applied
        assert prog.find_ops(op_type="constexpr_lut_to_dense")[0].lut.val.shape == (4,)
        assert prog.find_ops(op_type="constexpr_lut_to_dense")[1].lut.val.shape == (16,)

        set_op_type allow the user to set different config for each op type.
        Also checking that the config can be overwritten
        
coremltools/test/optimize/coreml/test_passes.py