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

[Frontend] [Tensorflow] ReadVariableOp operator support #4952

Merged
merged 3 commits into from
Mar 2, 2020

Conversation

maheshambule
Copy link
Contributor

@maheshambule maheshambule commented Feb 27, 2020

The ReadVariableOp gets eliminated when you freeze the TensorFlow graph. It is also not needed for the inference.
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/graph_util_impl.py#L464

If we find a ReadVariableOp in a TF graph, we error out and ask the user to provide a frozen graph.

TODO -
We may want to add support where we freeze the graph on the user's behalf when it is possible to freeze it otherwise we will throw an error.

@yongwww, @zhiics, @kevinthesun, @FrozenGene
Could you please review the PR?

# Add list of other operators as well which get removed
# and are not needed for inference.
# Other approach is instead of raising error, we can freeze the graph.
if 'ReadVariableOp' in missing_operators:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any other op falling into this case? If so, I suggest we create a list containing all these ops.

Copy link
Contributor Author

@maheshambule maheshambule Feb 28, 2020

Choose a reason for hiding this comment

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

Yes, there are.
I will compile the list and add it in.

Copy link
Contributor Author

@maheshambule maheshambule Mar 2, 2020

Choose a reason for hiding this comment

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

Added other operators as well

@maheshambule maheshambule requested a review from kevinthesun March 2, 2020 19:15
Copy link
Contributor

@kevinthesun kevinthesun left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinthesun kevinthesun merged commit 8502691 into apache:master Mar 2, 2020
@kevinthesun
Copy link
Contributor

Thanks @maheshambule

@maheshambule maheshambule deleted the tf_read_var_op branch March 3, 2020 06:21
@maheshambule
Copy link
Contributor Author

Thanks, @kevinthesun for review and comments.

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Apr 16, 2020
* tf frontend read variable op

* pylint fix

* tf frontend freezed graph pruned ops
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Apr 17, 2020
* tf frontend read variable op

* pylint fix

* tf frontend freezed graph pruned ops
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