def test_cast_fp16_output_bug_smoke(self, compute_unit, backend):
        """
        Since a fp16 output bug in Core ML can only be reproduced by non-CPU backends,
        for this test, we hardcode the compute_unit.
        """

        def build(x):
            return mb.cast(x=x, dtype="fp16")

        x = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32)
        expected_res = x.astype(dtype=np.float16)

        mlmodel = run_compare_builder(
            build,
            {"x": mb.placeholder(shape=x.shape, dtype=types.int32)},
            input_values={"x": x},
            expected_output_types=x.shape + (types.fp16,),
            expected_outputs=expected_res,
            compute_unit=compute_unit,
            backend=backend,
        )

        prog = mlmodel._mil_program
        assert get_op_types_in_program(prog) == ["cast"]
        cast_op = prog.find_ops(op_type="cast", exactly_one=True)[0]
        assert cast_op.dtype.val == "fp16"

        Since a fp16 output bug in Core ML can only be reproduced by non-CPU backends,
        for this test, we hardcode the compute_unit.
        
coremltools/converters/mil/mil/ops/tests/iOS17/test_elementwise_unary.py