Skip to content

Add support for data path in iOS #13620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add support for data path in iOS #13620

wants to merge 2 commits into from

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented Aug 22, 2025

Seems like mostly linter changes..

@lucylq lucylq requested a review from shoumikhin as a code owner August 22, 2025 23:12
Copy link

pytorch-bot bot commented Aug 22, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13620

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit 1198433 with merge base 4598fdb (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 22, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

}
return self;
}

- (instancetype)initWithFilePath:(NSString *)filePath
loadMode:(ExecuTorchModuleLoadMode)loadMode {
self = [super init];
Copy link
Contributor

@shoumikhin shoumikhin Aug 22, 2025

Choose a reason for hiding this comment

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

This one should just call the newly added with an empty data path, just like the one below calling it with the default load mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we have to pass in nil, which means the other constructor needs to cover both cases as well.

@lucylq lucylq force-pushed the lfq.data-support-ios branch 5 times, most recently from e6a920f to 0b78b72 Compare August 23, 2025 00:01
@lucylq lucylq force-pushed the lfq.data-support-ios branch from 0b78b72 to 2633a9d Compare August 23, 2025 00:03
Comment on lines +257 to +272
if (dataFilePath) {
_module = std::make_unique<Module>(
filePath.UTF8String,
dataFilePath.UTF8String,
static_cast<Module::LoadMode>(loadMode)
);
_inputs = [NSMutableDictionary new];
_outputs = [NSMutableDictionary new];
} else {
_module = std::make_unique<Module>(
filePath.UTF8String,
static_cast<Module::LoadMode>(loadMode)
);
_inputs = [NSMutableDictionary new];
_outputs = [NSMutableDictionary new];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (dataFilePath) {
_module = std::make_unique<Module>(
filePath.UTF8String,
dataFilePath.UTF8String,
static_cast<Module::LoadMode>(loadMode)
);
_inputs = [NSMutableDictionary new];
_outputs = [NSMutableDictionary new];
} else {
_module = std::make_unique<Module>(
filePath.UTF8String,
static_cast<Module::LoadMode>(loadMode)
);
_inputs = [NSMutableDictionary new];
_outputs = [NSMutableDictionary new];
}
_module = std::make_unique<Module>(
filePath.UTF8String,
dataFilePath.UTF8String,
static_cast<Module::LoadMode>(loadMode)
);
_inputs = [NSMutableDictionary new];
_outputs = [NSMutableDictionary new];

Comment on lines +277 to 286
- (instancetype)initWithFilePath:(NSString *)filePath
loadMode:(ExecuTorchModuleLoadMode)loadMode {
return [self initWithFilePath:filePath
dataFilePath:nil
loadMode:loadMode];
}

- (instancetype)initWithFilePath:(NSString *)filePath {
return [self initWithFilePath:filePath loadMode:ExecuTorchModuleLoadModeFile];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- (instancetype)initWithFilePath:(NSString *)filePath
loadMode:(ExecuTorchModuleLoadMode)loadMode {
return [self initWithFilePath:filePath
dataFilePath:nil
loadMode:loadMode];
}
- (instancetype)initWithFilePath:(NSString *)filePath {
return [self initWithFilePath:filePath loadMode:ExecuTorchModuleLoadModeFile];
}
- (instancetype)initWithFilePath:(NSString *)filePath
loadMode:(ExecuTorchModuleLoadMode)loadMode {
return [self initWithFilePath:filePath
dataFilePath:@""
loadMode:loadMode];
}
- (instancetype)initWithFilePath:(NSString *)filePath {
return [self initWithFilePath:filePath
dataFilePath:@""
loadMode:ExecuTorchModuleLoadModeFile];
}

dataFilePath:(NSString *)dataPath
loadMode:(ExecuTorchModuleLoadMode)loadMode
NS_DESIGNATED_INITIALIZER;

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove NS_DESIGNATED_INITIALIZER from the other constructor at L150 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants