def test_mixed_compression_algorithms(self):
        """
        This test is checking a program can be ran under different compression method
        """
        prog = self._get_test_program_2()

        # Run palettization for conv ops
        conv_config = cto.coreml.OpPalettizerConfig(
                nbits=1,
                mode="KMEANS",
                weight_threshold=100,
        )
        config = cto.coreml.OptimizationConfig()
        config.set_op_type("conv", conv_config)

        compressor = quantization.palettize_weights(config=config)
        compressor.apply(prog)

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

        # Run affine quantization for conv1 / linear1. Note that since conv1 is already compressed
        # the quantization makes no affect on it
        op_name_config = cto.coreml.OpLinearQuantizerConfig(
                mode="LINEAR_SYMMETRIC",
                dtype=np.int8,
                weight_threshold=100,
        )
        config = cto.coreml.OptimizationConfig()
        config.set_op_name("conv1", op_name_config)
        config.set_op_name("linear1", op_name_config)

        compressor = quantization.linear_quantize_weights(config=config)
        compressor.apply(prog)

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

        # Run sparsification for the whoel program
        global_config = cto.coreml.OpMagnitudePrunerConfig(
                target_sparsity=0.85,
                weight_threshold=100,
        )
        config = cto.coreml.OptimizationConfig(global_config=global_config)

        compressor = quantization.prune_weights(config=config)
        compressor.apply(prog)

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

        This test is checking a program can be ran under different compression method
        
coremltools/test/optimize/coreml/test_passes.py