Skip to content
Closed
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
21 changes: 21 additions & 0 deletions extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ - (BOOL)isLoaded {

- (BOOL)loadMethod:(NSString *)methodName
error:(NSError **)error {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto errorCode = _module->load_method(methodName.UTF8String);
#pragma clang diagnostic pop
if (errorCode != Error::Ok) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)errorCode);
Expand All @@ -325,11 +328,17 @@ - (BOOL)loadMethod:(NSString *)methodName
}

- (BOOL)isMethodLoaded:(NSString *)methodName {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
return _module->is_method_loaded(methodName.UTF8String);
#pragma clang diagnostic pop
}

- (BOOL)unloadMethod:(NSString *)methodName {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto didUnload = _module->unload_method(methodName.UTF8String);
#pragma clang diagnostic pop
[_inputs removeObjectForKey:methodName];
[_outputs removeObjectForKey:methodName];
return didUnload;
Expand All @@ -352,7 +361,10 @@ - (BOOL)unloadMethod:(NSString *)methodName {

- (nullable ExecuTorchMethodMetadata *)methodMetadata:(NSString *)methodName
error:(NSError **)error {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto result = _module->method_meta(methodName.UTF8String);
#pragma clang diagnostic pop
if (!result.ok()) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)result.error());
Expand Down Expand Up @@ -497,7 +509,10 @@ - (BOOL)setInput:(ExecuTorchValue *)value
forMethod:(NSString *)methodName
atIndex:(NSInteger)index
error:(NSError **)error {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto errorCode = _module->set_input(methodName.UTF8String, toEValue(value), index);
#pragma clang diagnostic pop
if (errorCode != Error::Ok) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)errorCode);
Expand Down Expand Up @@ -537,7 +552,10 @@ - (BOOL)setInputs:(NSArray<ExecuTorchValue *> *)values
for (ExecuTorchValue *value in values) {
inputs.push_back(toEValue(value));
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto errorCode = _module->set_inputs(methodName.UTF8String, inputs);
#pragma clang diagnostic pop
if (errorCode != Error::Ok) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)errorCode);
Expand Down Expand Up @@ -580,7 +598,10 @@ - (BOOL)setOutput:(ExecuTorchValue *)value
forMethod:(NSString *)methodName
atIndex:(NSInteger)index
error:(NSError **)error {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
const auto errorCode = _module->set_output(methodName.UTF8String, toEValue(value), index);
#pragma clang diagnostic pop
if (errorCode != Error::Ok) {
if (error) {
*error = ExecuTorchErrorWithCode((ExecuTorchErrorCode)errorCode);
Expand Down
Loading