def test_dequantize_const_to_constexpr(
        self, float_dtype, quant_dtype, is_scalar, is_zp_present
    ):
        """
        Input graph:
            input -> dequantize -> output

        Output graph:
            input -> constexpr_affine_dequantize -> output
        """

        @mb.program(input_specs=[])
        def prog():
            y = None
            if is_scalar:
                if is_zp_present:
                    y = mb.dequantize(
                        input=np.array([10, 11], dtype=quant_dtype),
                        scale=float_dtype(0.1),
                        zero_point=quant_dtype(2),
                    )
                else:
                    y = mb.dequantize(
                        input=np.array([13, 14, 15], dtype=quant_dtype), scale=float_dtype(0.2)
                    )
            else:
                if is_zp_present:
                    y = mb.dequantize(
                        input=np.array([[10, 11], [12, 13], [14, 15]], dtype=quant_dtype),
                        scale=np.array([0.1, 0.2, 0.3], dtype=float_dtype),
                        zero_point=np.array([6, 7, 8], dtype=quant_dtype),
                        axis=0,
                    )
                else:
                    y = mb.dequantize(
                        input=np.array([[19, 20, 21], [22, 23, 24]], dtype=quant_dtype),
                        scale=np.array([0.4, 0.5, 0.6], dtype=float_dtype),
                        axis=1,
                    )
            return y

        assert get_op_types_in_program(prog) == ["dequantize"]
        dequantize_op = prog.find_ops(op_type="dequantize")[0]
        assert dequantize_op.outputs[0].val is None
        assert dequantize_op.can_materialize_val()

        apply_pass_and_basic_check(prog, "common::dequantize_to_constexpr")
        assert get_op_types_in_program(prog) == ["constexpr_affine_dequantize"]

        Input graph:
            input -> dequantize -> output

        Output graph:
            input -> constexpr_affine_dequantize -> output
        
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py