Skip to content
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

Change the input to NNAPI EP ModelBuilder from ModelProto to GraphViewer #4389

Merged
merged 12 commits into from
Jul 7, 2020

Conversation

guoyu-wang
Copy link
Contributor

Description: Change the input to ModelBuilder from ModelProto to GraphViewer (No. 2 TODO in #4287)

Motivation and Context
In the previous iteration of the NNAPI EP, we use the ModelProto as the input to ModelBuilder, which has to be constructed from the Graph, which is not necessary and inefficient,

Changed to use the Graph_Viewer as the input of the ModelBuilder, which this change, it will be much easier to query the state of a node/tensor than using ModelProto

Not Included in This Change
This change is only to move from ModelProto to GraphViewer, while the functionalities remain the same as before, additional changes such as [Check the input/initializer of each individual operator while calling GetCapability()] (No. 8 TODO in #4287) will be addressed in future PRs

@guoyu-wang guoyu-wang requested a review from a team as a code owner July 1, 2020 05:57
@guoyu-wang guoyu-wang requested a review from skottmckay July 1, 2020 05:58
bool BaseOpBuilder::HasExternalInitializer(ModelBuilder& model_builder,
const onnxruntime::Node& node) {
const auto& initializers(model_builder.GetOnnxGraph().GetAllInitializedTensors());
for (const auto* node_arg : node.InputDefs()) {
Copy link
Contributor

@skottmckay skottmckay Jul 2, 2020

Choose a reason for hiding this comment

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

Would probably be quicker to create a set of external intializer names once and just checking against that. #WontFix

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 guess this will be true if we have some reused initializers, will keep this as is for now since I do not really want to add another member variable to the ModelBuilder


In reply to: 448725831 [](ancestors = 448725831)

Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

🕐

@guoyu-wang guoyu-wang requested a review from skottmckay July 4, 2020 01:51
Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

@guoyu-wang guoyu-wang merged commit 7baf374 into master Jul 7, 2020
@guoyu-wang guoyu-wang deleted the nnapi_use_graph branch July 7, 2020 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants