-
Notifications
You must be signed in to change notification settings - Fork 836
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
Break dependency of kernels on MicroGraph #2186
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The control flow and resource kernels make calls into MicroGraph by using the MicroContext::graph() accessor. For interpreter-less invoke, we don't need a full MicroGraph, only the subset of functionality that the kernels use. This PR introduces an abstract base class for MicroGraphInfo, which MicroGraph implements. The kernels only depend on MicroGraphInfo, but the MicroContext will still have a full MicroGraph. BUG=b/295174086
rascani
force-pushed
the
micro_graph_refactor
branch
from
August 24, 2023 22:08
2a5de6f
to
4d83fab
Compare
Instead of introducing a new base class called MicroGraphInfo, this commit makes MicroGraph the abstract base class and moves the implementation of MicroGraph to MicroInterpreterGraph. The kernel changes were all reverted, as they'll use MicroGraph instead of MicroGraphInfo. The Interpreter and related test infrastructure will all use the MicroInterpreterContext class.
rascani
commented
Aug 29, 2023
#include "tensorflow/lite/schema/schema_generated.h" | ||
|
||
namespace tflite { | ||
|
||
// MockMicroGraph stubs out all MicroGraph methods used during invoke. A count | ||
// of the number of calls to invoke for each subgraph is maintained for | ||
// validation of control flow operators. | ||
class MockMicroGraph : public MicroGraph { |
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'd like to fix this to be dependent on the abstract type. I'm gonna try to fix that before landing.
Closing in favor of #2202 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The control flow and resource kernels make calls into MicroGraph by using the MicroContext::graph() accessor. For interpreter-less invoke, we don't need a full MicroGraph, only the subset of functionality that the kernels use. This PR makes MicroGraph an abstract base class, which MicroInterpreterGraph now implements. Existing MicroGraph functionality was all moved to MicroInterpreterGraph. The kernels only depend on MicroGraph, but the MicroContext will still have a full MicroInterpreterGraph.
BUG=b/295174086