def test_export_state_input_feature(self):
        """
        Test milproto can export model with state type.
        """

        @mb.program(
            input_specs=[
                mb.StateTensorSpec((2, 3), dtype=types.fp16),
            ],
            opset_version=ct.target.iOS18,
        )
        def prog(x):
            return mb.read_state(input=x, name="output")

        # verify the model can be converted
        mlmodel = ct.convert(
            prog,
            convert_to="mlprogram",
            minimum_deployment_target=ct.target.iOS18,
            compute_units=ct.ComputeUnit.CPU_ONLY,
        )

        # verify the state feature
        spec = mlmodel.get_spec()
        state = spec.description.state
        assert len(state) == 1
        assert state[0].name == "x"
        assert state[0].type.WhichOneof("Type") == "stateType"
        assert state[0].type.stateType.WhichOneof("Type") == "arrayType"

        array_type = state[0].type.stateType.arrayType
        assert array_type.shape == [2, 3]
        assert array_type.dataType == proto.FeatureTypes_pb2.ArrayFeatureType.FLOAT16

        # verify the model
        expected_output = np.zeros((2, 3))
        self.verify_stateful_model(mlmodel, expected_output)

        Test milproto can export model with state type.
        
coremltools/converters/mil/backend/mil/test_load.py