@@ -20,21 +20,20 @@ __attribute__((deprecated("This API is experimental.")))
2020@interface ExecuTorchTensorMetadata : NSObject
2121
2222/* * The size of each dimension. */
23- @property (nonatomic, readonly) NSArray<NSNumber *> *shape
24- NS_REFINED_FOR_SWIFT;
23+ @property(nonatomic, readonly) NSArray<NSNumber *> *shape NS_REFINED_FOR_SWIFT;
2524
2625/* * The order in which dimensions are laid out. */
27- @property (nonatomic, readonly) NSArray < NSNumber *> *dimensionOrder
28- NS_REFINED_FOR_SWIFT;
26+ @property(nonatomic, readonly)
27+ NSArray < NSNumber *> *dimensionOrder NS_REFINED_FOR_SWIFT;
2928
3029/* * The scalar type of each element in the tensor. */
31- @property (nonatomic, readonly) ExecuTorchDataType dataType;
30+ @property(nonatomic, readonly) ExecuTorchDataType dataType;
3231
3332/* * YES if the runtime pre-allocated memory for this tensor. */
34- @property (nonatomic, readonly) BOOL isMemoryPlanned;
33+ @property(nonatomic, readonly) BOOL isMemoryPlanned;
3534
3635/* * The (optional) user-visible name of this tensor (may be empty) */
37- @property (nonatomic, readonly) NSString *name;
36+ @property(nonatomic, readonly) NSString *name;
3837
3938+ (instancetype )new NS_UNAVAILABLE;
4039- (instancetype )init NS_UNAVAILABLE;
@@ -51,42 +50,45 @@ __attribute__((deprecated("This API is experimental.")))
5150@interface ExecuTorchMethodMetadata : NSObject
5251
5352/* * The method’s name. */
54- @property (nonatomic, readonly) NSString *name;
53+ @property(nonatomic, readonly) NSString *name;
5554
5655/* * An array of ExecuTorchValueTag raw values, one per declared input. */
57- @property (nonatomic, readonly) NSArray < NSNumber *> *inputValueTags
58- NS_REFINED_FOR_SWIFT;
56+ @property(nonatomic, readonly)
57+ NSArray < NSNumber *> *inputValueTags NS_REFINED_FOR_SWIFT;
5958
6059/* * An array of ExecuTorchValueTag raw values, one per declared output. */
61- @property (nonatomic, readonly) NSArray < NSNumber *> *outputValueTags
62- NS_REFINED_FOR_SWIFT;
60+ @property(nonatomic, readonly)
61+ NSArray < NSNumber *> *outputValueTags NS_REFINED_FOR_SWIFT;
6362
6463/* *
6564 * Mapping from input-index to TensorMetadata.
6665 * Only present for those indices whose tag == .tensor
6766 */
68- @property (nonatomic, readonly) NSDictionary <NSNumber *, ExecuTorchTensorMetadata *> *inputTensorMetadata
69- NS_REFINED_FOR_SWIFT;
67+ @property(nonatomic, readonly)
68+ NSDictionary <NSNumber *, ExecuTorchTensorMetadata *> *inputTensorMetadata
69+ NS_REFINED_FOR_SWIFT;
7070
7171/* *
7272 * Mapping from output-index to TensorMetadata.
7373 * Only present for those indices whose tag == .tensor
7474 */
75- @property (nonatomic, readonly) NSDictionary <NSNumber *, ExecuTorchTensorMetadata *> *outputTensorMetadata
76- NS_REFINED_FOR_SWIFT;
75+ @property(nonatomic, readonly)
76+ NSDictionary <NSNumber *, ExecuTorchTensorMetadata *> *outputTensorMetadata
77+ NS_REFINED_FOR_SWIFT;
7778
7879/* * A list of attribute TensorsMetadata. */
79- @property (nonatomic, readonly) NSArray <ExecuTorchTensorMetadata *> *attributeTensorMetadata;
80+ @property(nonatomic, readonly)
81+ NSArray <ExecuTorchTensorMetadata *> *attributeTensorMetadata;
8082
8183/* * A list of memory-planned buffer sizes. */
82- @property (nonatomic, readonly) NSArray < NSNumber *> *memoryPlannedBufferSizes
83- NS_REFINED_FOR_SWIFT;
84+ @property(nonatomic, readonly)
85+ NSArray < NSNumber *> *memoryPlannedBufferSizes NS_REFINED_FOR_SWIFT;
8486
8587/* * Names of all backends this method can run on. */
86- @property (nonatomic, readonly) NSArray <NSString *> *backendNames;
88+ @property(nonatomic, readonly) NSArray <NSString *> *backendNames;
8789
8890/* * Total number of low-level instructions in this method’s body. */
89- @property (nonatomic, readonly) NSInteger instructionCount;
91+ @property(nonatomic, readonly) NSInteger instructionCount;
9092
9193+ (instancetype )new NS_UNAVAILABLE;
9294- (instancetype )init NS_UNAVAILABLE;
@@ -111,33 +113,53 @@ typedef NS_ENUM(NSInteger, ExecuTorchModuleLoadMode) {
111113 * runtime/executor/program.h
112114 */
113115typedef NS_ENUM (uint8_t , ExecuTorchVerification) {
114- ExecuTorchVerificationMinimal,
115- ExecuTorchVerificationInternalConsistency,
116+ ExecuTorchVerificationMinimal,
117+ ExecuTorchVerificationInternalConsistency,
116118} NS_SWIFT_NAME(ModuleVerification);
117119
118120/* *
119121 * Represents a module that encapsulates an ExecuTorch program.
120- * This class is a facade for loading programs and executing methods within them.
122+ * This class is a facade for loading programs and executing methods within
123+ * them.
121124 */
122125NS_SWIFT_NAME (Module)
123126__attribute__((deprecated(" This API is experimental." )))
124127@interface ExecuTorchModule : NSObject
125128
126129/* *
127- * Initializes a module with a file path and a specified load mode.
130+ * Initializes a module with a file path, data path, and a specified load mode.
128131 *
129- * @param filePath A string representing the path to the ExecuTorch program file.
130- * @param loadMode A value from ExecuTorchModuleLoadMode that determines the file loading behavior.
132+ * @param filePath A string representing the path to the ExecuTorch program
133+ * file.
134+ * @param dataPath A string representing the path to the data file containing
135+ * external constants/tensors.
136+ * @param loadMode A value from ExecuTorchModuleLoadMode that determines the
137+ * file loading behavior.
131138 * @return An initialized ExecuTorchModule instance.
132139 */
133140- (instancetype )initWithFilePath:(NSString *)filePath
141+ dataPath:(NSString *)dataPath
134142 loadMode:(ExecuTorchModuleLoadMode)loadMode
135143 NS_DESIGNATED_INITIALIZER;
136144
137145/* *
138- * Initializes a module with a file path using the default load mode (File mode).
146+ * Initializes a module with a file path and a specified load mode.
147+ *
148+ * @param filePath A string representing the path to the ExecuTorch program
149+ * file.
150+ * @param loadMode A value from ExecuTorchModuleLoadMode that determines the
151+ * file loading behavior.
152+ * @return An initialized ExecuTorchModule instance.
153+ */
154+ - (instancetype )initWithFilePath:(NSString *)filePath
155+ loadMode:(ExecuTorchModuleLoadMode)loadMode;
156+
157+ /* *
158+ * Initializes a module with a file path using the default load mode (File
159+ * mode).
139160 *
140- * @param filePath A string representing the path to the ExecuTorch program file.
161+ * @param filePath A string representing the path to the ExecuTorch program
162+ * file.
141163 * @return An initialized ExecuTorchModule instance.
142164 */
143165- (instancetype )initWithFilePath:(NSString *)filePath;
@@ -146,7 +168,8 @@ __attribute__((deprecated("This API is experimental.")))
146168 * Loads the module’s program using the specified verification level.
147169 *
148170 * @param verification The verification level to apply when loading the program.
149- * @param error A pointer to an NSError pointer that will be set if an error occurs.
171+ * @param error A pointer to an NSError pointer that will be set if an error
172+ * occurs.
150173 * @return YES if the program was successfully loaded; otherwise, NO.
151174 */
152175- (BOOL )loadWithVerification:(ExecuTorchVerification)verification
@@ -155,9 +178,11 @@ __attribute__((deprecated("This API is experimental.")))
155178/* *
156179 * Loads the module’s program using minimal verification.
157180 *
158- * This is a convenience overload that defaults the verification level to Minimal.
181+ * This is a convenience overload that defaults the verification level to
182+ * Minimal.
159183 *
160- * @param error A pointer to an NSError pointer that will be set if an error occurs.
184+ * @param error A pointer to an NSError pointer that will be set if an error
185+ * occurs.
161186 * @return YES if the program was successfully loaded; otherwise, NO.
162187 */
163188- (BOOL )load:(NSError **)error;
@@ -198,8 +223,8 @@ __attribute__((deprecated("This API is experimental.")))
198223/* *
199224 * Retrieves the set of method names available in the loaded program.
200225 *
201- * The method names are returned as an unordered set of strings. The program and methods
202- * are loaded as needed.
226+ * The method names are returned as an unordered set of strings. The program and
227+ * methods are loaded as needed.
203228 *
204229 * @param error A pointer to an NSError pointer that is set if an error occurs.
205230 * @return An unordered set of method names, or nil in case of an error.
@@ -215,10 +240,11 @@ __attribute__((deprecated("This API is experimental.")))
215240 *
216241 * @param methodName A string representing the method name.
217242 * @param error A pointer to an NSError pointer that is set if an error occurs.
218- * @return An ExecuTorchMethodMetadata object on success, or nil if the method isn’t found or a load error occurred.
243+ * @return An ExecuTorchMethodMetadata object on success, or nil if the method
244+ * isn’t found or a load error occurred.
219245 */
220- - (nullable ExecuTorchMethodMetadata *)methodMetadata:(NSString *)methodName
221- error:(NSError **)error
246+ - (nullable ExecuTorchMethodMetadata *)methodMetadata:(NSString *)methodName
247+ error:(NSError **)error
222248 NS_RETURNS_RETAINED;
223249
224250/* *
@@ -229,13 +255,13 @@ __attribute__((deprecated("This API is experimental.")))
229255 * @param methodName A string representing the method name.
230256 * @param values An NSArray of ExecuTorchValue objects representing the inputs.
231257 * @param error A pointer to an NSError pointer that is set if an error occurs.
232- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
258+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
259+ * nil in case of an error.
233260 */
234- - (nullable NSArray <ExecuTorchValue *> *)executeMethod:(NSString *)methodName
235- withInputs:(NSArray <ExecuTorchValue *> *)values
236- error:(NSError **)error
237- NS_REFINED_FOR_SWIFT
238- NS_RETURNS_RETAINED;
261+ - (nullable NSArray <ExecuTorchValue *> *)
262+ executeMethod:(NSString *)methodName
263+ withInputs:(NSArray <ExecuTorchValue *> *)values
264+ error:(NSError **)error NS_REFINED_FOR_SWIFT NS_RETURNS_RETAINED;
239265
240266/* *
241267 * Executes a specific method with the provided single input value.
@@ -245,13 +271,13 @@ __attribute__((deprecated("This API is experimental.")))
245271 * @param methodName A string representing the method name.
246272 * @param value An ExecuTorchValue object representing the input.
247273 * @param error A pointer to an NSError pointer that is set if an error occurs.
248- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
274+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
275+ * nil in case of an error.
249276 */
250277- (nullable NSArray <ExecuTorchValue *> *)executeMethod:(NSString *)methodName
251278 withInput:(ExecuTorchValue *)value
252279 error:(NSError **)error
253- NS_SWIFT_UNAVAILABLE (" " )
254- NS_RETURNS_RETAINED;
280+ NS_SWIFT_UNAVAILABLE (" " )NS_RETURNS_RETAINED;
255281
256282/* *
257283 * Executes a specific method with no input values.
@@ -260,28 +286,29 @@ __attribute__((deprecated("This API is experimental.")))
260286 *
261287 * @param methodName A string representing the method name.
262288 * @param error A pointer to an NSError pointer that is set if an error occurs.
263- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
289+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
290+ * nil in case of an error.
264291 */
265292- (nullable NSArray <ExecuTorchValue *> *)executeMethod:(NSString *)methodName
266293 error:(NSError **)error
267- NS_SWIFT_NAME (execute(_:))
268- NS_RETURNS_RETAINED;
294+ NS_SWIFT_NAME (execute(_:)) NS_RETURNS_RETAINED;
269295
270296/* *
271297 * Executes a specific method with the provided input tensors.
272298 *
273299 * The method is loaded on demand if not already loaded.
274300 *
275301 * @param methodName A string representing the method name.
276- * @param tensors An NSArray of ExecuTorchTensor objects representing the inputs.
302+ * @param tensors An NSArray of ExecuTorchTensor objects representing the
303+ * inputs.
277304 * @param error A pointer to an NSError pointer that is set if an error occurs.
278- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
305+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
306+ * nil in case of an error.
279307 */
280- - (nullable NSArray <ExecuTorchValue *> *)executeMethod:(NSString *)methodName
281- withTensors:(NSArray <ExecuTorchTensor *> *)tensors
282- error:(NSError **)error
283- NS_SWIFT_UNAVAILABLE (" " )
284- NS_RETURNS_RETAINED;
308+ - (nullable NSArray <ExecuTorchValue *> *)
309+ executeMethod:(NSString *)methodName
310+ withTensors:(NSArray <ExecuTorchTensor *> *)tensors
311+ error:(NSError **)error NS_SWIFT_UNAVAILABLE (" " )NS_RETURNS_RETAINED;
285312
286313/* *
287314 * Executes a specific method with the provided single input tensor.
@@ -291,80 +318,92 @@ __attribute__((deprecated("This API is experimental.")))
291318 * @param methodName A string representing the method name.
292319 * @param tensor An ExecuTorchTensor object representing the input.
293320 * @param error A pointer to an NSError pointer that is set if an error occurs.
294- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
321+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
322+ * nil in case of an error.
295323 */
296324- (nullable NSArray <ExecuTorchValue *> *)executeMethod:(NSString *)methodName
297- withTensor:(ExecuTorchTensor *)tensor
325+ withTensor:
326+ (ExecuTorchTensor *)tensor
298327 error:(NSError **)error
299- NS_SWIFT_UNAVAILABLE (" " )
300- NS_RETURNS_RETAINED;
328+ NS_SWIFT_UNAVAILABLE (" " )NS_RETURNS_RETAINED;
301329
302330/* *
303331 * Executes the "forward" method with the provided input values.
304332 *
305- * This is a convenience method that calls the executeMethod with "forward" as the method name.
333+ * This is a convenience method that calls the executeMethod with "forward" as
334+ * the method name.
306335 *
307336 * @param values An NSArray of ExecuTorchValue objects representing the inputs.
308337 * @param error A pointer to an NSError pointer that is set if an error occurs.
309- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
338+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
339+ * nil in case of an error.
310340 */
311- - (nullable NSArray <ExecuTorchValue *> *)forwardWithInputs:( NSArray <ExecuTorchValue *> *)values
312- error:( NSError **)error
313- NS_SWIFT_UNAVAILABLE ( " " )
314- NS_RETURNS_RETAINED;
341+ - (nullable NSArray <ExecuTorchValue *> *)
342+ forwardWithInputs:( NSArray <ExecuTorchValue *> *)values
343+ error:( NSError **)error
344+ NS_SWIFT_UNAVAILABLE ( " " ) NS_RETURNS_RETAINED;
315345
316346/* *
317347 * Executes the "forward" method with the provided single input value.
318348 *
319- * This is a convenience method that calls the executeMethod with "forward" as the method name.
349+ * This is a convenience method that calls the executeMethod with "forward" as
350+ * the method name.
320351 *
321352 * @param value An ExecuTorchValue object representing the input.
322353 * @param error A pointer to an NSError pointer that is set if an error occurs.
323- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
354+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
355+ * nil in case of an error.
324356 */
325- - (nullable NSArray <ExecuTorchValue *> *)forwardWithInput:(ExecuTorchValue *)value
357+ - (nullable NSArray <ExecuTorchValue *> *)forwardWithInput:
358+ (ExecuTorchValue *)value
326359 error:(NSError **)error
327- NS_SWIFT_UNAVAILABLE (" " )
328- NS_RETURNS_RETAINED;
360+ NS_SWIFT_UNAVAILABLE (" " )NS_RETURNS_RETAINED;
329361
330362/* *
331363 * Executes the "forward" method with no inputs.
332364 *
333- * This is a convenience method that calls the executeMethod with "forward" as the method name.
365+ * This is a convenience method that calls the executeMethod with "forward" as
366+ * the method name.
334367 *
335368 * @param error A pointer to an NSError pointer that is set if an error occurs.
336- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
369+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
370+ * nil in case of an error.
337371 */
338372- (nullable NSArray <ExecuTorchValue *> *)forward:(NSError **)error
339373 NS_RETURNS_RETAINED;
340374
341375/* *
342376 * Executes the "forward" method with the provided input tensors.
343377 *
344- * This is a convenience method that calls the executeMethod with "forward" as the method name.
378+ * This is a convenience method that calls the executeMethod with "forward" as
379+ * the method name.
345380 *
346- * @param tensors An NSArray of ExecuTorchTensor objects representing the inputs.
381+ * @param tensors An NSArray of ExecuTorchTensor objects representing the
382+ * inputs.
347383 * @param error A pointer to an NSError pointer that is set if an error occurs.
348- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
384+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
385+ * nil in case of an error.
349386 */
350- - (nullable NSArray <ExecuTorchValue *> *)forwardWithTensors:( NSArray <ExecuTorchTensor *> *)tensors
351- error:( NSError **)error
352- NS_SWIFT_UNAVAILABLE ( " " )
353- NS_RETURNS_RETAINED;
387+ - (nullable NSArray <ExecuTorchValue *> *)
388+ forwardWithTensors:( NSArray <ExecuTorchTensor *> *)tensors
389+ error:( NSError **)error
390+ NS_SWIFT_UNAVAILABLE ( " " ) NS_RETURNS_RETAINED;
354391
355392/* *
356393 * Executes the "forward" method with the provided single input tensor.
357394 *
358- * This is a convenience method that calls the executeMethod with "forward" as the method name.
395+ * This is a convenience method that calls the executeMethod with "forward" as
396+ * the method name.
359397 *
360398 * @param tensor An ExecuTorchTensor object representing the input.
361399 * @param error A pointer to an NSError pointer that is set if an error occurs.
362- * @return An NSArray of ExecuTorchValue objects representing the outputs, or nil in case of an error.
400+ * @return An NSArray of ExecuTorchValue objects representing the outputs, or
401+ * nil in case of an error.
363402 */
364- - (nullable NSArray <ExecuTorchValue *> *)forwardWithTensor:(ExecuTorchTensor *)tensor
403+ - (nullable NSArray <ExecuTorchValue *> *)forwardWithTensor:
404+ (ExecuTorchTensor *)tensor
365405 error:(NSError **)error
366- NS_SWIFT_UNAVAILABLE (" " )
367- NS_RETURNS_RETAINED;
406+ NS_SWIFT_UNAVAILABLE (" " )NS_RETURNS_RETAINED;
368407
369408/* *
370409 * Sets a single input value for the "forward" method at index 0.
0 commit comments