def test_export_coreml_update_state(self):
        """
        The ``coreml_update_state`` dialect op is decomposed into:
            write_state -> read_state
        """

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

        mlmodel = ct.convert(
            prog,
            convert_to="mlprogram",
            minimum_deployment_target=ct.target.iOS18,
            compute_units=ct.ComputeUnit.CPU_ONLY,
        )

        mil = mlmodel.get_spec().mlProgram
        for function in mil.functions.values():
            for block in function.block_specializations.values():
                ops = list(block.operations)
                assert ops[0].type == "write_state"
                assert len(ops[0].outputs) == 0
                assert ops[1].type == "read_state"

        # verify the model
        input = np.random.rand(2, 3)
        self.verify_stateful_model(mlmodel, input, input)

        The ``coreml_update_state`` dialect op is decomposed into:
            write_state -> read_state
        
coremltools/converters/mil/backend/mil/test_load.py