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

Add logic to NNAPI EP to exclude pre-processing involving dynamic shapes when partitioning #10452

Merged
merged 7 commits into from
Feb 2, 2022

Conversation

YUNQIUGUO
Copy link
Contributor

Description: Describe your changes.

Add logic to EPs to exclude pre-processing involving dynamic shapes when partitioning

  • move dynamic input shape check to op support checker level
  • add basic test graph and test cases

Motivation and Context

  • Why is this change required? What problem does it solve?
  • If it fixes an open issue, please link to the issue here.

check if it's just the initial part of the graph using dynamic input that becomes fixed after a Resize so that the new insertion of pre-processing logic does not prevent NNAPI being used.

@YUNQIUGUO YUNQIUGUO changed the title Add logic to EPs to exclude pre-processing involving dynamic shapes when partitioning Add logic to NNAPI EP to exclude pre-processing involving dynamic shapes when partitioning Feb 2, 2022
ASSERT_STATUS_OK(session_object.RegisterExecutionProvider(std::make_unique<NnapiExecutionProvider>(0)));
ASSERT_STATUS_OK(session_object.Load(model_file_name));
ASSERT_STATUS_OK(session_object.Initialize());
ASSERT_GT(CountAssignedNodes(session_object.GetGraph(), kNnapiExecutionProvider), 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

For this particular graph, the number of assigned nodes (Add only) should be 1, can use ASSERT_EQ instead of ASSERT_GT



if __name__ == "__main__":
GenerateModel('nnapi_dynamic_graph_input_test.onnx')
Copy link
Contributor

Choose a reason for hiding this comment

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

This model can be applied to CoreML as well, can change the name to something like dynamic_graph_input_test.onnx or `ep_dynamic_graph_input_test.onnx'?

@YUNQIUGUO YUNQIUGUO merged commit 97b8f6f into master Feb 2, 2022
@YUNQIUGUO YUNQIUGUO deleted the yguo/dynamic-input-shape-nnapi branch February 2, 2022 23:54
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