xref: /aosp_15_r20/external/executorch/backends/apple/coreml/runtime/delegate/ETCoreMLModelCompiler.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 //
2 // ETCoreMLModelCompiler.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 #import <CoreML/CoreML.h>
9 
10 NS_ASSUME_NONNULL_BEGIN
11 /// A class responsible for compiling a CoreML model.
12 __attribute__((objc_subclassing_restricted))
13 @interface ETCoreMLModelCompiler : NSObject
14 
15 + (instancetype)new NS_UNAVAILABLE;
16 
17 - (instancetype)init NS_UNAVAILABLE;
18 
19 /// Synchronously compiles a model given the location of its on-disk representation.
20 ///
21 /// @param modelURL The location of the model's on-disk representation (.mlpackage directory).
22 /// @param maxWaitTimeInSeconds The maximum wait time in seconds.
23 /// @param error   On failure, error is filled with the failure information.
24 + (nullable NSURL*)compileModelAtURL:(NSURL*)modelURL
25                 maxWaitTimeInSeconds:(NSTimeInterval)maxWaitTimeInSeconds
26                                error:(NSError* __autoreleasing*)error;
27 
28 @end
29 
30 NS_ASSUME_NONNULL_END
31