1 // 2 // MLModel+Prewarm.h 3 // 4 // Copyright © 2024 Apple Inc. All rights reserved. 5 // 6 // Please refer to the license found in the LICENSE file in the root directory of the source tree. 7 8 9 #import <CoreML/CoreML.h> 10 11 #if !defined(MODEL_STATE_IS_SUPPORTED) && __has_include(<CoreML/MLModel+MLState.h>) 12 #define MODEL_STATE_IS_SUPPORTED 1 13 #endif 14 15 NS_ASSUME_NONNULL_BEGIN 16 17 @interface MLModel (Prewarm) 18 19 /// Pre-warms the model by running a prediction with zeroed-out inputs. 20 /// 21 /// @param state The model state. 22 /// @param error On failure, error is filled with the failure information. 23 /// @retval `YES` if the prediction succeeded otherwise `NO`. 24 - (BOOL)prewarmUsingState:(nullable id)state error:(NSError* __autoreleasing*)error; 25 26 @end 27 28 NS_ASSUME_NONNULL_END 29