Returns a new state object, which can be passed to the ``predict`` method. Returns _______ state: MLState Holds state for an MLModel. State functionality is only supported on macOS 15+. Examples -------- .. sourcecode::
(self)
| 925 | return f[0] |
| 926 | |
| 927 | def make_state(self) -> MLState: |
| 928 | """ |
| 929 | Returns a new state object, which can be passed to the ``predict`` method. |
| 930 | |
| 931 | Returns |
| 932 | _______ |
| 933 | state: MLState |
| 934 | Holds state for an MLModel. |
| 935 | |
| 936 | State functionality is only supported on macOS 15+. |
| 937 | |
| 938 | Examples |
| 939 | -------- |
| 940 | .. sourcecode:: python |
| 941 | |
| 942 | state = model.make_state() |
| 943 | predictions = model.predict(x, state) |
| 944 | |
| 945 | See Also |
| 946 | -------- |
| 947 | predict |
| 948 | """ |
| 949 | if not _is_macos() or _macos_version() < (15, 0): |
| 950 | raise Exception("State functionality is only supported on macOS 15+") |
| 951 | if self.__proxy__ is None: |
| 952 | raise Exception("This model was not loaded with the Core ML Framework. Cannot get state.") |
| 953 | |
| 954 | return MLState(self.__proxy__.newState()) |
| 955 | |
| 956 | |
| 957 | def _input_has_infinite_upper_bound(self) -> bool: |