-
Notifications
You must be signed in to change notification settings - Fork 695
Add "load_by_name" API at wasi-nn #4267
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,14 +85,11 @@ is_valid_graph(TFLiteContext *tfl_ctx, graph g) | |
NN_ERR_PRINTF("Invalid graph: %d >= %d.", g, MAX_GRAPHS_PER_INST); | ||
return runtime_error; | ||
} | ||
if (tfl_ctx->models[g].model_pointer == NULL) { | ||
if (tfl_ctx->models[g].model_pointer == NULL | ||
&& tfl_ctx->models[g].model == NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original version can output different information based on various invalid argument cases. Is there a specific reason we need to merge them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If call load_by_name(), there is no need to save the tflite buf to model_pointer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why not free model_point after below operation in load() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is required to validate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whether it is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why is that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after this operation, the |
||
NN_ERR_PRINTF("Context (model) non-initialized."); | ||
return runtime_error; | ||
} | ||
if (tfl_ctx->models[g].model == NULL) { | ||
NN_ERR_PRINTF("Context (tflite model) non-initialized."); | ||
return runtime_error; | ||
} | ||
return success; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a bug fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasi_nn.h is a header for WebAssembly applications written in the C language. Is there a specific reason that we need to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, its a bugfix,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have two sets of APIs for historical reasons, we might remove one in another PR. For now, let's ensure both are functional.
WASM_ENABLE_WASI_EPHEMERAL_NN
on the wasm side.native_symbols_wasi_nn
in wasi_nn.c