-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc
Show resolved
Hide resolved
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc
Show resolved
Hide resolved
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc
Show resolved
Hide resolved
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/op_builder.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/op_builder.cc
Outdated
Show resolved
Hide resolved
bool BaseOpBuilder::HasExternalInitializer(ModelBuilder& model_builder, | ||
const onnxruntime::Node& node) { | ||
const auto& initializers(model_builder.GetOnnxGraph().GetAllInitializedTensors()); | ||
for (const auto* node_arg : node.InputDefs()) { |
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.
Would probably be quicker to create a set of external intializer names once and just checking against that. #WontFix
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.
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)
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.
🕐
… the caller, remove some redundant onnxruntime namespace
…er minor logging changes
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.
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