react-native-executorch 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/android/libs/classes.jar +0 -0
  2. package/android/src/main/cpp/CMakeLists.txt +23 -14
  3. package/common/rnexecutorch/RnExecutorchInstaller.cpp +4 -21
  4. package/common/rnexecutorch/host_objects/ModelHostObject.h +67 -51
  5. package/common/rnexecutorch/models/llm/LLM.cpp +24 -1
  6. package/common/rnexecutorch/models/llm/LLM.h +4 -1
  7. package/common/rnexecutorch/threads/GlobalThreadPool.h +79 -0
  8. package/common/rnexecutorch/threads/HighPerformanceThreadPool.h +364 -0
  9. package/common/rnexecutorch/threads/utils/ThreadUtils.h +29 -0
  10. package/common/runner/runner.cpp +9 -3
  11. package/common/runner/runner.h +4 -3
  12. package/common/runner/text_token_generator.h +28 -10
  13. package/lib/Error.js +53 -0
  14. package/lib/ThreadPool.d.ts +10 -0
  15. package/lib/ThreadPool.js +28 -0
  16. package/lib/common/Logger.d.ts +8 -0
  17. package/lib/common/Logger.js +19 -0
  18. package/lib/constants/directories.js +2 -0
  19. package/lib/constants/llmDefaults.d.ts +6 -0
  20. package/lib/constants/llmDefaults.js +16 -0
  21. package/lib/constants/modelUrls.d.ts +223 -0
  22. package/lib/constants/modelUrls.js +322 -0
  23. package/lib/constants/ocr/models.d.ts +882 -0
  24. package/lib/constants/ocr/models.js +182 -0
  25. package/lib/constants/ocr/symbols.js +139 -0
  26. package/lib/constants/sttDefaults.d.ts +28 -0
  27. package/lib/constants/sttDefaults.js +68 -0
  28. package/lib/controllers/LLMController.d.ts +47 -0
  29. package/lib/controllers/LLMController.js +213 -0
  30. package/lib/controllers/OCRController.js +67 -0
  31. package/lib/controllers/SpeechToTextController.d.ts +56 -0
  32. package/lib/controllers/SpeechToTextController.js +349 -0
  33. package/lib/controllers/VerticalOCRController.js +70 -0
  34. package/lib/hooks/computer_vision/useClassification.d.ts +15 -0
  35. package/lib/hooks/computer_vision/useClassification.js +7 -0
  36. package/lib/hooks/computer_vision/useImageEmbeddings.d.ts +15 -0
  37. package/lib/hooks/computer_vision/useImageEmbeddings.js +7 -0
  38. package/lib/hooks/computer_vision/useImageSegmentation.d.ts +38 -0
  39. package/lib/hooks/computer_vision/useImageSegmentation.js +7 -0
  40. package/lib/hooks/computer_vision/useOCR.d.ts +20 -0
  41. package/lib/hooks/computer_vision/useOCR.js +41 -0
  42. package/lib/hooks/computer_vision/useObjectDetection.d.ts +15 -0
  43. package/lib/hooks/computer_vision/useObjectDetection.js +7 -0
  44. package/lib/hooks/computer_vision/useStyleTransfer.d.ts +15 -0
  45. package/lib/hooks/computer_vision/useStyleTransfer.js +7 -0
  46. package/lib/hooks/computer_vision/useVerticalOCR.d.ts +21 -0
  47. package/lib/hooks/computer_vision/useVerticalOCR.js +43 -0
  48. package/lib/hooks/general/useExecutorchModule.d.ts +13 -0
  49. package/lib/hooks/general/useExecutorchModule.js +7 -0
  50. package/lib/hooks/natural_language_processing/useLLM.d.ts +10 -0
  51. package/lib/hooks/natural_language_processing/useLLM.js +78 -0
  52. package/lib/hooks/natural_language_processing/useSpeechToText.d.ts +27 -0
  53. package/lib/hooks/natural_language_processing/useSpeechToText.js +49 -0
  54. package/lib/hooks/natural_language_processing/useTextEmbeddings.d.ts +16 -0
  55. package/lib/hooks/natural_language_processing/useTextEmbeddings.js +7 -0
  56. package/lib/hooks/natural_language_processing/useTokenizer.d.ts +17 -0
  57. package/lib/hooks/natural_language_processing/useTokenizer.js +52 -0
  58. package/lib/hooks/useModule.js +45 -0
  59. package/lib/hooks/useNonStaticModule.d.ts +20 -0
  60. package/lib/hooks/useNonStaticModule.js +49 -0
  61. package/lib/index.d.ts +48 -0
  62. package/lib/index.js +58 -0
  63. package/lib/module/controllers/LLMController.js +21 -2
  64. package/lib/module/controllers/LLMController.js.map +1 -1
  65. package/lib/module/hooks/natural_language_processing/useLLM.js +6 -2
  66. package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
  67. package/lib/module/modules/natural_language_processing/LLMModule.js +7 -2
  68. package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
  69. package/lib/module/types/llm.js.map +1 -1
  70. package/lib/modules/BaseModule.js +25 -0
  71. package/lib/modules/BaseNonStaticModule.js +14 -0
  72. package/lib/modules/computer_vision/ClassificationModule.d.ts +8 -0
  73. package/lib/modules/computer_vision/ClassificationModule.js +17 -0
  74. package/lib/modules/computer_vision/ImageEmbeddingsModule.d.ts +8 -0
  75. package/lib/modules/computer_vision/ImageEmbeddingsModule.js +17 -0
  76. package/lib/modules/computer_vision/ImageSegmentationModule.d.ts +11 -0
  77. package/lib/modules/computer_vision/ImageSegmentationModule.js +27 -0
  78. package/lib/modules/computer_vision/OCRModule.d.ts +14 -0
  79. package/lib/modules/computer_vision/OCRModule.js +17 -0
  80. package/lib/modules/computer_vision/ObjectDetectionModule.d.ts +9 -0
  81. package/lib/modules/computer_vision/ObjectDetectionModule.js +17 -0
  82. package/lib/modules/computer_vision/StyleTransferModule.d.ts +8 -0
  83. package/lib/modules/computer_vision/StyleTransferModule.js +17 -0
  84. package/lib/modules/computer_vision/VerticalOCRModule.d.ts +14 -0
  85. package/lib/modules/computer_vision/VerticalOCRModule.js +19 -0
  86. package/lib/modules/general/ExecutorchModule.d.ts +7 -0
  87. package/lib/modules/general/ExecutorchModule.js +14 -0
  88. package/lib/modules/natural_language_processing/LLMModule.d.ts +28 -0
  89. package/lib/modules/natural_language_processing/LLMModule.js +45 -0
  90. package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +24 -0
  91. package/lib/modules/natural_language_processing/SpeechToTextModule.js +36 -0
  92. package/lib/modules/natural_language_processing/TextEmbeddingsModule.d.ts +9 -0
  93. package/lib/modules/natural_language_processing/TextEmbeddingsModule.js +21 -0
  94. package/lib/modules/natural_language_processing/TokenizerModule.d.ts +12 -0
  95. package/lib/modules/natural_language_processing/TokenizerModule.js +30 -0
  96. package/lib/native/NativeETInstaller.js +2 -0
  97. package/lib/native/NativeOCR.js +2 -0
  98. package/lib/native/NativeVerticalOCR.js +2 -0
  99. package/lib/native/RnExecutorchModules.d.ts +7 -0
  100. package/lib/native/RnExecutorchModules.js +18 -0
  101. package/lib/tsconfig.tsbuildinfo +1 -0
  102. package/lib/types/common.d.ts +32 -0
  103. package/lib/types/common.js +25 -0
  104. package/lib/types/imageSegmentation.js +26 -0
  105. package/lib/types/llm.d.ts +46 -0
  106. package/lib/types/llm.js +9 -0
  107. package/lib/types/objectDetection.js +94 -0
  108. package/lib/types/ocr.js +1 -0
  109. package/lib/types/stt.d.ts +94 -0
  110. package/lib/types/stt.js +85 -0
  111. package/lib/typescript/controllers/LLMController.d.ts +4 -2
  112. package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
  113. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
  114. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +4 -2
  115. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
  116. package/lib/typescript/types/llm.d.ts +7 -1
  117. package/lib/typescript/types/llm.d.ts.map +1 -1
  118. package/lib/utils/ResourceFetcher.d.ts +24 -0
  119. package/lib/utils/ResourceFetcher.js +305 -0
  120. package/lib/utils/ResourceFetcherUtils.d.ts +54 -0
  121. package/lib/utils/ResourceFetcherUtils.js +127 -0
  122. package/lib/utils/llm.d.ts +6 -0
  123. package/lib/utils/llm.js +72 -0
  124. package/lib/utils/stt.js +21 -0
  125. package/package.json +3 -1
  126. package/react-native-executorch.podspec +12 -31
  127. package/src/controllers/LLMController.ts +29 -5
  128. package/src/hooks/natural_language_processing/useLLM.ts +15 -1
  129. package/src/modules/natural_language_processing/LLMModule.ts +14 -2
  130. package/src/types/llm.ts +8 -0
  131. package/third-party/android/libs/cpuinfo/arm64-v8a/libcpuinfo.so +0 -0
  132. package/third-party/android/libs/executorch/arm64-v8a/libexecutorch.so +0 -0
  133. package/third-party/android/libs/executorch/x86_64/libexecutorch.so +0 -0
  134. package/third-party/android/libs/pthreadpool/arm64-v8a/libpthreadpool.so +0 -0
  135. package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libsentencepiece.a +0 -0
  136. package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libtokenizers_c.a +0 -0
  137. package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libtokenizers_cpp.a +0 -0
  138. package/third-party/android/libs/tokenizers-cpp/x86_64/libsentencepiece.a +0 -0
  139. package/third-party/android/libs/tokenizers-cpp/x86_64/libtokenizers_c.a +0 -0
  140. package/third-party/android/libs/tokenizers-cpp/x86_64/libtokenizers_cpp.a +0 -0
  141. package/third-party/include/c10/macros/Export.h +2 -86
  142. package/third-party/include/c10/macros/Macros.h +28 -5
  143. package/third-party/include/c10/util/BFloat16-inl.h +1 -4
  144. package/third-party/include/c10/util/BFloat16.h +5 -8
  145. package/third-party/include/c10/util/Half.h +5 -0
  146. package/third-party/include/c10/util/bit_cast.h +1 -1
  147. package/third-party/include/c10/util/complex.h +639 -0
  148. package/third-party/include/c10/util/complex_math.h +399 -0
  149. package/third-party/include/c10/util/complex_utils.h +41 -0
  150. package/third-party/include/c10/util/irange.h +2 -2
  151. package/third-party/include/c10/util/overflows.h +95 -0
  152. package/third-party/include/executorch/ExecuTorchError.h +75 -0
  153. package/third-party/include/executorch/ExecuTorchModule.h +115 -11
  154. package/third-party/include/executorch/ExecuTorchTensor.h +731 -51
  155. package/third-party/include/executorch/ExecuTorchValue.h +61 -9
  156. package/third-party/include/executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h +181 -0
  157. package/third-party/include/executorch/extension/kernel_util/meta_programming.h +108 -0
  158. package/third-party/include/executorch/extension/kernel_util/type_list.h +137 -0
  159. package/third-party/include/executorch/extension/module/bundled_module.h +131 -0
  160. package/third-party/include/executorch/extension/module/module.h +46 -20
  161. package/third-party/include/executorch/extension/threadpool/cpuinfo_utils.h +1 -3
  162. package/third-party/include/executorch/extension/threadpool/threadpool.h +1 -3
  163. package/third-party/include/executorch/extension/threadpool/threadpool_guard.h +35 -0
  164. package/third-party/include/executorch/runtime/backend/backend_execution_context.h +3 -3
  165. package/third-party/include/executorch/runtime/backend/backend_init_context.h +12 -6
  166. package/third-party/include/executorch/runtime/backend/backend_option_context.h +34 -0
  167. package/third-party/include/executorch/runtime/backend/interface.h +70 -9
  168. package/third-party/include/executorch/runtime/backend/options.h +206 -0
  169. package/third-party/include/executorch/runtime/core/evalue.h +19 -25
  170. package/third-party/include/executorch/runtime/core/event_tracer.h +32 -17
  171. package/third-party/include/executorch/runtime/core/event_tracer_hooks.h +23 -14
  172. package/third-party/include/executorch/runtime/core/exec_aten/exec_aten.h +32 -9
  173. package/third-party/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +3 -2
  174. package/third-party/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +43 -75
  175. package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_util.h +88 -87
  176. package/third-party/include/executorch/runtime/core/function_ref.h +100 -0
  177. package/third-party/include/executorch/runtime/core/named_data_map.h +14 -14
  178. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +2 -86
  179. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +28 -5
  180. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +1 -4
  181. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +5 -8
  182. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +5 -0
  183. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +1 -1
  184. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex.h +639 -0
  185. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex_math.h +399 -0
  186. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex_utils.h +41 -0
  187. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +2 -2
  188. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/overflows.h +95 -0
  189. package/third-party/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h +88 -0
  190. package/third-party/include/executorch/runtime/core/portable_type/complex.h +6 -29
  191. package/third-party/include/executorch/runtime/core/portable_type/tensor_impl.h +20 -0
  192. package/third-party/include/executorch/runtime/core/span.h +4 -0
  193. package/third-party/include/executorch/runtime/core/tag.h +19 -0
  194. package/third-party/include/executorch/runtime/core/tensor_layout.h +2 -2
  195. package/third-party/include/executorch/runtime/executor/method.h +15 -3
  196. package/third-party/include/executorch/runtime/executor/method_meta.h +34 -5
  197. package/third-party/include/executorch/runtime/executor/program.h +3 -4
  198. package/third-party/include/executorch/runtime/executor/pte_data_map.h +9 -8
  199. package/third-party/include/executorch/runtime/executor/tensor_parser.h +14 -13
  200. package/third-party/include/executorch/runtime/kernel/kernel_runtime_context.h +5 -5
  201. package/third-party/include/executorch/runtime/kernel/operator_registry.h +21 -19
  202. package/third-party/include/executorch/runtime/platform/compiler.h +8 -0
  203. package/third-party/include/executorch/runtime/platform/platform.h +126 -0
  204. package/third-party/include/headeronly/macros/Export.h +88 -0
  205. package/third-party/include/tokenizers-cpp/tokenizers_c.h +61 -0
  206. package/third-party/include/torch/headeronly/macros/Export.h +88 -0
  207. package/third-party/ios/ExecutorchLib.xcframework/Info.plist +43 -0
  208. package/third-party/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
  209. package/third-party/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
  210. package/third-party/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
  211. package/third-party/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
  212. package/third-party/ios/libs/cpuinfo/libcpuinfo.a +0 -0
  213. package/third-party/ios/libs/pthreadpool/physical-arm64-release/libpthreadpool.a +0 -0
  214. package/third-party/ios/libs/pthreadpool/simulator-arm64-debug/libpthreadpool.a +0 -0
  215. package/ios/libs/executorch/libbackend_coreml_ios.a +0 -0
  216. package/ios/libs/executorch/libbackend_coreml_simulator.a +0 -0
  217. package/ios/libs/executorch/libbackend_mps_ios.a +0 -0
  218. package/ios/libs/executorch/libbackend_mps_simulator.a +0 -0
  219. package/ios/libs/executorch/libbackend_xnnpack_ios.a +0 -0
  220. package/ios/libs/executorch/libbackend_xnnpack_simulator.a +0 -0
  221. package/ios/libs/executorch/libexecutorch_ios.a +0 -0
  222. package/ios/libs/executorch/libexecutorch_simulator.a +0 -0
  223. package/ios/libs/executorch/libkernels_custom_ios.a +0 -0
  224. package/ios/libs/executorch/libkernels_custom_simulator.a +0 -0
  225. package/ios/libs/executorch/libkernels_optimized_ios.a +0 -0
  226. package/ios/libs/executorch/libkernels_optimized_simulator.a +0 -0
  227. package/ios/libs/executorch/libkernels_portable_ios.a +0 -0
  228. package/ios/libs/executorch/libkernels_portable_simulator.a +0 -0
  229. package/ios/libs/executorch/libkernels_quantized_ios.a +0 -0
  230. package/ios/libs/executorch/libkernels_quantized_simulator.a +0 -0
  231. package/third-party/ios/ios.toolchain.cmake +0 -1122
  232. /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libsentencepiece.a +0 -0
  233. /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libtokenizers_c.a +0 -0
  234. /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libtokenizers_cpp.a +0 -0
  235. /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libsentencepiece.a +0 -0
  236. /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_c.a +0 -0
  237. /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_cpp.a +0 -0
@@ -10,6 +10,91 @@
10
10
 
11
11
  NS_ASSUME_NONNULL_BEGIN
12
12
 
13
+ /**
14
+ * Holds the static metadata for a single tensor: its shape, layout,
15
+ * element type, whether its memory was pre-planned by the runtime,
16
+ * and its debug name.
17
+ */
18
+ NS_SWIFT_NAME(TensorMetadata)
19
+ __attribute__((deprecated("This API is experimental.")))
20
+ @interface ExecuTorchTensorMetadata : NSObject
21
+
22
+ /** The size of each dimension. */
23
+ @property(nonatomic, readonly) NSArray<NSNumber *> *shape NS_REFINED_FOR_SWIFT;
24
+
25
+ /** The order in which dimensions are laid out. */
26
+ @property(nonatomic, readonly)
27
+ NSArray<NSNumber *> *dimensionOrder NS_REFINED_FOR_SWIFT;
28
+
29
+ /** The scalar type of each element in the tensor. */
30
+ @property(nonatomic, readonly) ExecuTorchDataType dataType;
31
+
32
+ /** YES if the runtime pre-allocated memory for this tensor. */
33
+ @property(nonatomic, readonly) BOOL isMemoryPlanned;
34
+
35
+ /** The (optional) user-visible name of this tensor (may be empty) */
36
+ @property(nonatomic, readonly) NSString *name;
37
+
38
+ + (instancetype)new NS_UNAVAILABLE;
39
+ - (instancetype)init NS_UNAVAILABLE;
40
+
41
+ @end
42
+
43
+ /**
44
+ * Encapsulates all of the metadata for a loaded method: its name,
45
+ * how many inputs/outputs/attributes it has, per-argument tags,
46
+ * per-tensor metadata, buffer sizes, backends, and instruction count.
47
+ */
48
+ NS_SWIFT_NAME(MethodMetadata)
49
+ __attribute__((deprecated("This API is experimental.")))
50
+ @interface ExecuTorchMethodMetadata : NSObject
51
+
52
+ /** The method’s name. */
53
+ @property(nonatomic, readonly) NSString *name;
54
+
55
+ /** An array of ExecuTorchValueTag raw values, one per declared input. */
56
+ @property(nonatomic, readonly)
57
+ NSArray<NSNumber *> *inputValueTags NS_REFINED_FOR_SWIFT;
58
+
59
+ /** An array of ExecuTorchValueTag raw values, one per declared output. */
60
+ @property(nonatomic, readonly)
61
+ NSArray<NSNumber *> *outputValueTags NS_REFINED_FOR_SWIFT;
62
+
63
+ /**
64
+ * Mapping from input-index to TensorMetadata.
65
+ * Only present for those indices whose tag == .tensor
66
+ */
67
+ @property(nonatomic, readonly)
68
+ NSDictionary<NSNumber *, ExecuTorchTensorMetadata *> *inputTensorMetadata
69
+ NS_REFINED_FOR_SWIFT;
70
+
71
+ /**
72
+ * Mapping from output-index to TensorMetadata.
73
+ * Only present for those indices whose tag == .tensor
74
+ */
75
+ @property(nonatomic, readonly)
76
+ NSDictionary<NSNumber *, ExecuTorchTensorMetadata *> *outputTensorMetadata
77
+ NS_REFINED_FOR_SWIFT;
78
+
79
+ /** A list of attribute TensorsMetadata. */
80
+ @property(nonatomic, readonly)
81
+ NSArray<ExecuTorchTensorMetadata *> *attributeTensorMetadata;
82
+
83
+ /** A list of memory-planned buffer sizes. */
84
+ @property(nonatomic, readonly)
85
+ NSArray<NSNumber *> *memoryPlannedBufferSizes NS_REFINED_FOR_SWIFT;
86
+
87
+ /** Names of all backends this method can run on. */
88
+ @property(nonatomic, readonly) NSArray<NSString *> *backendNames;
89
+
90
+ /** Total number of low-level instructions in this method’s body. */
91
+ @property(nonatomic, readonly) NSInteger instructionCount;
92
+
93
+ + (instancetype)new NS_UNAVAILABLE;
94
+ - (instancetype)init NS_UNAVAILABLE;
95
+
96
+ @end
97
+
13
98
  /**
14
99
  * Enum to define loading behavior.
15
100
  * Values can be a subset, but must numerically match exactly those defined in
@@ -121,7 +206,23 @@ __attribute__((deprecated("This API is experimental.")))
121
206
  * @param error A pointer to an NSError pointer that is set if an error occurs.
122
207
  * @return An unordered set of method names, or nil in case of an error.
123
208
  */
124
- - (nullable NSSet<NSString *> *)methodNames:(NSError **)error;
209
+ - (nullable NSSet<NSString *> *)methodNames:(NSError **)error
210
+ NS_RETURNS_RETAINED;
211
+
212
+ /**
213
+ * Retrieves full metadata for a particular method in the loaded module.
214
+ *
215
+ * This includes the method’s name, input/output value tags, tensor shapes
216
+ * and layouts, buffer sizes, backend support list, and instruction count.
217
+ *
218
+ * @param methodName A string representing the method name.
219
+ * @param error A pointer to an NSError pointer that is set if an error occurs.
220
+ * @return An ExecuTorchMethodMetadata object on success, or nil if the method
221
+ * isn’t found or a load error occurred.
222
+ */
223
+ - (nullable ExecuTorchMethodMetadata *)methodMetadata:(NSString *)methodName
224
+ error:(NSError **)error
225
+ NS_RETURNS_RETAINED;
125
226
 
126
227
  /**
127
228
  * Executes a specific method with the provided input values.
@@ -137,7 +238,7 @@ __attribute__((deprecated("This API is experimental.")))
137
238
  - (nullable NSArray<ExecuTorchValue *> *)
138
239
  executeMethod:(NSString *)methodName
139
240
  withInputs:(NSArray<ExecuTorchValue *> *)values
140
- error:(NSError **)error NS_SWIFT_NAME(execute(_:_:));
241
+ error:(NSError **)error NS_REFINED_FOR_SWIFT NS_RETURNS_RETAINED;
141
242
 
142
243
  /**
143
244
  * Executes a specific method with the provided single input value.
@@ -153,7 +254,7 @@ __attribute__((deprecated("This API is experimental.")))
153
254
  - (nullable NSArray<ExecuTorchValue *> *)executeMethod:(NSString *)methodName
154
255
  withInput:(ExecuTorchValue *)value
155
256
  error:(NSError **)error
156
- NS_SWIFT_NAME(execute(_:_:));
257
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
157
258
 
158
259
  /**
159
260
  * Executes a specific method with no input values.
@@ -167,7 +268,7 @@ __attribute__((deprecated("This API is experimental.")))
167
268
  */
168
269
  - (nullable NSArray<ExecuTorchValue *> *)executeMethod:(NSString *)methodName
169
270
  error:(NSError **)error
170
- NS_SWIFT_NAME(execute(_:));
271
+ NS_SWIFT_NAME(execute(_:)) NS_RETURNS_RETAINED;
171
272
 
172
273
  /**
173
274
  * Executes a specific method with the provided input tensors.
@@ -184,7 +285,7 @@ __attribute__((deprecated("This API is experimental.")))
184
285
  - (nullable NSArray<ExecuTorchValue *> *)
185
286
  executeMethod:(NSString *)methodName
186
287
  withTensors:(NSArray<ExecuTorchTensor *> *)tensors
187
- error:(NSError **)error NS_SWIFT_NAME(execute(_:_:));
288
+ error:(NSError **)error NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
188
289
 
189
290
  /**
190
291
  * Executes a specific method with the provided single input tensor.
@@ -201,7 +302,7 @@ __attribute__((deprecated("This API is experimental.")))
201
302
  withTensor:
202
303
  (ExecuTorchTensor *)tensor
203
304
  error:(NSError **)error
204
- NS_SWIFT_NAME(execute(_:_:));
305
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
205
306
 
206
307
  /**
207
308
  * Executes the "forward" method with the provided input values.
@@ -216,7 +317,8 @@ __attribute__((deprecated("This API is experimental.")))
216
317
  */
217
318
  - (nullable NSArray<ExecuTorchValue *> *)
218
319
  forwardWithInputs:(NSArray<ExecuTorchValue *> *)values
219
- error:(NSError **)error NS_SWIFT_NAME(forward(_:));
320
+ error:(NSError **)error
321
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
220
322
 
221
323
  /**
222
324
  * Executes the "forward" method with the provided single input value.
@@ -232,7 +334,7 @@ __attribute__((deprecated("This API is experimental.")))
232
334
  - (nullable NSArray<ExecuTorchValue *> *)forwardWithInput:
233
335
  (ExecuTorchValue *)value
234
336
  error:(NSError **)error
235
- NS_SWIFT_NAME(forward(_:));
337
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
236
338
 
237
339
  /**
238
340
  * Executes the "forward" method with no inputs.
@@ -244,7 +346,8 @@ __attribute__((deprecated("This API is experimental.")))
244
346
  * @return An NSArray of ExecuTorchValue objects representing the outputs, or
245
347
  * nil in case of an error.
246
348
  */
247
- - (nullable NSArray<ExecuTorchValue *> *)forward:(NSError **)error;
349
+ - (nullable NSArray<ExecuTorchValue *> *)forward:(NSError **)error
350
+ NS_RETURNS_RETAINED;
248
351
 
249
352
  /**
250
353
  * Executes the "forward" method with the provided input tensors.
@@ -260,7 +363,8 @@ __attribute__((deprecated("This API is experimental.")))
260
363
  */
261
364
  - (nullable NSArray<ExecuTorchValue *> *)
262
365
  forwardWithTensors:(NSArray<ExecuTorchTensor *> *)tensors
263
- error:(NSError **)error NS_SWIFT_NAME(forward(_:));
366
+ error:(NSError **)error
367
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
264
368
 
265
369
  /**
266
370
  * Executes the "forward" method with the provided single input tensor.
@@ -276,7 +380,7 @@ __attribute__((deprecated("This API is experimental.")))
276
380
  - (nullable NSArray<ExecuTorchValue *> *)forwardWithTensor:
277
381
  (ExecuTorchTensor *)tensor
278
382
  error:(NSError **)error
279
- NS_SWIFT_NAME(forward(_:));
383
+ NS_SWIFT_UNAVAILABLE("")NS_RETURNS_RETAINED;
280
384
 
281
385
  + (instancetype)new NS_UNAVAILABLE;
282
386
  - (instancetype)init NS_UNAVAILABLE;