Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,21 @@ - (nullable ExecuTorchMethodMetadata *)methodMetadata:(NSString *)methodName
- (nullable NSArray<ExecuTorchValue *> *)executeMethod:(NSString *)methodName
withInputs:(NSArray<ExecuTorchValue *> *)values
error:(NSError **)error {
std::vector<EValue> inputs;
inputs.reserve(values.count);
for (ExecuTorchValue *value in values) {
inputs.push_back(toEValue(value));
const char *methodNameString = methodName.UTF8String;
__block auto errorCode = Error::Ok;
[values enumerateObjectsUsingBlock:^(ExecuTorchValue *value, NSUInteger index, BOOL *stop) {
errorCode = _module->set_input(methodNameString, toEValue(value), index);
if (errorCode != Error::Ok) {
*stop = YES;
}
}];
if (errorCode != Error::Ok) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)errorCode);
}
return nil;
}
const auto result = _module->execute(methodName.UTF8String, inputs);
const auto result = _module->execute(methodNameString);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding, I can still call execute again right after this without set_input again right? I.e. the input_set state doesn't get reset after each execute, right?

if (!result.ok()) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)result.error());
Expand Down
Loading