def test_global_config_pruner(
        self, mode, threshold, target_sparsity, weight_threshold, fake_compression
    ):
        """
        Global config would compress all operations with the same config
        """
        if mode == "THRESHOLD_BASED":
            op_config = cto.coreml.OpThresholdPrunerConfig(
                threshold=threshold,
                weight_threshold=weight_threshold,
                minimum_sparsity_percentile=0.0,
            )
        else:
            assert mode == "PERCENTILE_BASED"
            op_config = cto.coreml.OpMagnitudePrunerConfig(
                target_sparsity=target_sparsity,
                weight_threshold=weight_threshold,
            )

        config = cto.coreml.OptimizationConfig(global_config=op_config)
        compressor = quantization.prune_weights(config=config, fake_compression=fake_compression)
        prog = self._get_test_program()
        compressor.apply(prog)

        if fake_compression:
            expected_ops = ["conv", "reshape", "linear", "reshape", "conv_transpose"]
        elif weight_threshold == 1000:
            expected_ops = [
                "constexpr_sparse_to_dense",
                "conv",
                "reshape",
                "constexpr_sparse_to_dense",
                "linear",
                "reshape",
                "constexpr_sparse_to_dense",
                "conv_transpose",
            ]
        else:
            assert weight_threshold == 7000
            # linear weight size < 7000
            expected_ops = [
                "constexpr_sparse_to_dense",
                "conv",
                "reshape",
                "linear",
                "reshape",
                "constexpr_sparse_to_dense",
                "conv_transpose",
            ]
        assert get_op_types_in_program(prog) == expected_ops

        Global config would compress all operations with the same config
        
coremltools/test/optimize/coreml/test_passes.py