def test_divide_by_zero_operation(self):
        """
        Input graph:
            input ------|
                        |-> div -> output
            const(eps) -|

        Output graph:
            input ------> cast(fp32->fp16) -|
                                            |-> div -> cast(fp16->fp32) -> output
            const(eps) -> cast(fp32->fp16) -|
        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(10, 20))])
        def prog(x):
            eps = mb.const(val=1e-10)
            x = mb.real_div(x=x, y=eps)
            return x

        prev_prog, prev_block, block = apply_pass_and_basic_check(
            prog, quantization.FP16ComputePrecision(op_selector=lambda op: True)
        )

        mlmodel = ct.convert(prog, compute_units=ct.ComputeUnit.CPU_ONLY)
        input_dict = {"x": np.random.rand(10, 20) * 1e-3}

        if _IS_MACOS:
            prediction = mlmodel.predict(input_dict)
            assert not np.isnan(prediction["real_div_0"]).any()
            assert np.isfinite(prediction["real_div_0"]).all()

        Input graph:
            input ------|
                        |-> div -> output
            const(eps) -|

        Output graph:
            input ------> cast(fp32->fp16) -|
                                            |-> div -> cast(fp16->fp32) -> output
            const(eps) -> cast(fp32->fp16) -|
        
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py