def test_single_state_single_input_model_fp16(self, float16_buffer_model, compute_unit):
        """
        Tests conversion of a stateful torch model defined in fp16.
        This will be common in model with large size.
        """
        # fp16 state / input
        mlmodel = ct.convert(
            float16_buffer_model,
            inputs=[
                ct.TensorType(shape=(3,), dtype=np.float16),
            ],
            states=[
                ct.StateType(wrapped_type=ct.TensorType(shape=(3,), dtype=np.float16), name="state")
            ],
            minimum_deployment_target=ct.target.iOS18,
            convert_to="mlprogram",
            compute_units=compute_unit,
        )
        prog = mlmodel._mil_program
        assert get_op_types_in_program(prog) == [
            "read_state",
            "mul",
            "coreml_update_state",
            "add",
            "coreml_update_state",
            "mul",
        ]
        verify_prediction(mlmodel)

        # force state / input to be fp32 (intented stress test)
        prog = ct.convert(
            float16_buffer_model,
            inputs=[
                ct.TensorType(shape=(3,), dtype=np.float32),
            ],
            states=[
                ct.StateType(
                    wrapped_type=ct.TensorType(shape=(3,), dtype=np.float32), name="state"
                ),
            ],
            minimum_deployment_target=ct.target.iOS18,
            convert_to="milinternal",
        )
        assert get_op_types_in_program(prog) == [
            "read_state",
            "cast",
            "cast",
            "mul",
            "cast",
            "coreml_update_state",
            "cast",
            "add",
            "cast",
            "coreml_update_state",
            "cast",
            "mul",
        ]

        Tests conversion of a stateful torch model defined in fp16.
        This will be common in model with large size.
        
coremltools/converters/mil/frontend/torch/test/test_torch_stateful_model.py