def test_keep_block_output_dequantize(self, is_zp_present, is_axis_present):
        """
        Input graph:
            input -> quantize0 -> dequantize1 -> quantize1 -> dequantize2 -> add -> quantize2 -> dequantize3 -> output

        Nothing changes when dequantize1 is a block output
        """

        SHAPE = (2, 3)
        scale, zero_point, axis = self.generate_scale_zp_axis(SHAPE, is_zp_present, is_axis_present)

        @mb.program(input_specs=[mb.TensorSpec(shape=SHAPE, dtype=types.fp32)])
        def prog(x):
            # quantize input
            quantized_0 = mb.quantize(
                input=x, scale=scale, zero_point=zero_point, axis=axis, output_dtype="int8"
            )
            # redundant dequantize-quantize pair
            dequantized_1 = mb.dequantize(
                input=quantized_0, scale=scale, zero_point=zero_point, axis=axis
            )
            quantized_1 = mb.quantize(
                input=dequantized_1,
                scale=scale,
                zero_point=zero_point,
                axis=axis,
                output_dtype="int8",
            )
            # dequantize-op-quantize sandwich
            dequantized_2 = mb.dequantize(
                input=quantized_1, scale=scale, zero_point=zero_point, axis=axis
            )
            y = mb.add(x=dequantized_2, y=dequantized_2)
            quantized_2 = mb.quantize(input=y, scale=0.1, output_dtype="int8")
            # dequantize output
            dequantized_3 = mb.dequantize(input=quantized_2, scale=0.1)
            return dequantized_1, dequantized_3

        prev_prog, _, _ = apply_pass_and_basic_check(
            prog, "common::dequantize_quantize_pair_elimination"
        )
        assert get_op_types_in_program(prev_prog) == [
            "quantize",
            "dequantize",
            "quantize",
            "dequantize",
            "add",
            "quantize",
            "dequantize",
        ]
        # nothing gets eliminated
        assert get_op_types_in_program(prog) == [
            "quantize",
            "dequantize",
            "quantize",
            "dequantize",
            "add",
            "quantize",
            "dequantize",
        ]

        Input graph:
            input -> quantize0 -> dequantize1 -> quantize1 -> dequantize2 -> add -> quantize2 -> dequantize3 -> output

        Nothing changes when dequantize1 is a block output
        
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py