def test_global_config_activation_quantizer_on_pattern_1(self, mode, dtype, weight_threshold):
        """
        Global config would compress all operations with the same config
        Valid patterns:
        - conv
        - conv + relu
        """

        # Insert prefix quantize/dequantize pairs
        op_config = cto.coreml.OpLinearQuantizerConfig(
            mode=mode, dtype=dtype, weight_threshold=weight_threshold
        )
        config = cto.coreml.OptimizationConfig(global_config=op_config)

        # Test case: conv
        prog = self._get_test_program_conv()

        # Create activation_stats to all intermediate tensors
        activation_stats = gen_activation_stats_for_program(prog)

        # Insert prefix quantize/dequantize pairs
        graph_pass_1 = _insert_prefix_quantize_dequantize_pair(config)
        graph_pass_1.set_options([PassOption("activation_stats", activation_stats)])

        # Insert suffix quantize/dequantize pairs
        graph_pass_2 = PASS_REGISTRY["compression::insert_suffix_quantize_dequantize_pair"]
        graph_pass_2.set_options(
            [PassOption("config", config), PassOption("activation_stats", activation_stats)]
        )

        apply_pass_and_basic_check(prog, graph_pass_1)
        apply_pass_and_basic_check(prog, graph_pass_2)

        assert get_op_types_in_program(prog) == [
            "cast",
            "quantize",
            "dequantize",
            "conv",
            "quantize",
            "dequantize",
            "cast",
        ]

        # Test case: conv + relu
        prog = self._get_test_program_conv_relu()

        # Create activation_stats to all intermediate tensors
        activation_stats = gen_activation_stats_for_program(prog)

        # Insert prefix quantize/dequantize pairs
        graph_pass_1 = _insert_prefix_quantize_dequantize_pair(config)
        graph_pass_1.set_options([PassOption("activation_stats", activation_stats)])

        # Insert suffix quantize/dequantize pairs
        graph_pass_2 = PASS_REGISTRY["compression::insert_suffix_quantize_dequantize_pair"]
        graph_pass_2.set_options(
            [PassOption("config", config), PassOption("activation_stats", activation_stats)]
        )

        apply_pass_and_basic_check(prog, graph_pass_1)
        apply_pass_and_basic_check(prog, graph_pass_2)

        assert get_op_types_in_program(prog) == [
            "cast",
            "quantize",
            "dequantize",
            "conv",
            "relu",
            "quantize",
            "dequantize",
            "cast",
        ]

        Global config would compress all operations with the same config
        Valid patterns:
        - conv
        - conv + relu
        
coremltools/test/optimize/coreml/test_passes.py