def test_epsilon_mixed_precision(self, opset_version, op_name):
        """The IOS17+ elementwise unary ops with epsilon support mixed precision."""

        @mb.program(input_specs=[mb.TensorSpec(shape=(2, 3))], opset_version=opset_version)
        def prog(x):
            return getattr(mb, op_name)(x=x, epsilon=0.1)

        _, _, block = apply_pass_and_basic_check(prog, "common::add_fp16_cast")

        expected_ops = ["cast", "cast", op_name, "cast"]
        if opset_version is not None and opset_version >= ct.target.iOS17:
            # Allow mixed precision, so the epsilon is not cast to fp16.
            expected_ops = ["cast", op_name, "cast"]
        assert get_op_types_in_program(prog) == expected_ops

        assert_model_is_valid(
            prog,
            {"x": (2, 3)},
            expected_output_shapes={block.outputs[0].name: (2, 3)},
            backend=("mlprogram", "fp16"),
            minimum_deployment_target=opset_version,
        )
The IOS17+ elementwise unary ops with epsilon support mixed precision.
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py