File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
extension/apple/ExecuTorch/Exported Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,21 @@ NS_SWIFT_NAME(Module)
123123__attribute__((deprecated(" This API is experimental." )))
124124@interface ExecuTorchModule : NSObject
125125
126+ /* *
127+ * Initializes a module with a file path, data path and a specified load mode.
128+ *
129+ * @param filePath A string representing the path to the ExecuTorch program file.
130+ * @param dataFilePath A string representing the path to a .ptd file with
131+ * external tensors and external data.
132+ * @param loadMode A value from ExecuTorchModuleLoadMode that determines the
133+ * file loading behavior.
134+ * @return An initialized ExecuTorchModule instance.
135+ */
136+ - (instancetype )initWithFilePath:(NSString *)filePath
137+ dataFilePath:(NSString *)dataPath
138+ loadMode:(ExecuTorchModuleLoadMode)loadMode
139+ NS_DESIGNATED_INITIALIZER;
140+
126141/* *
127142 * Initializes a module with a file path and a specified load mode.
128143 *
Original file line number Diff line number Diff line change @@ -249,6 +249,22 @@ @implementation ExecuTorchModule {
249249 NSMutableDictionary <NSString *, NSMutableArray <ExecuTorchValue *> *> *_outputs;
250250}
251251
252+ - (instancetype )initWithFilePath : (NSString *)filePath
253+ dataFilePath : (NSString *)dataFilePath
254+ loadMode : (ExecuTorchModuleLoadMode)loadMode {
255+ self = [super init ];
256+ if (self) {
257+ _module = std::make_unique<Module>(
258+ filePath.UTF8String ,
259+ dataFilePath.UTF8String ,
260+ static_cast <Module::LoadMode>(loadMode)
261+ );
262+ _inputs = [NSMutableDictionary new ];
263+ _outputs = [NSMutableDictionary new ];
264+ }
265+ return self;
266+ }
267+
252268- (instancetype )initWithFilePath : (NSString *)filePath
253269 loadMode : (ExecuTorchModuleLoadMode)loadMode {
254270 self = [super init ];
You can’t perform that action at this time.
0 commit comments