-
Notifications
You must be signed in to change notification settings - Fork 74k
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
[TransformGraph & TF2 SavedModel] - Missing API #43688
Comments
Thanks for filing the issue @DEKHTIARJonathan. Taking a look and will get back to you. |
So I believe that API was removed from the 2.0 pip package. It appears the recommended alternative is to build it from source using bazel. @annarev do you perhaps have more context into alternatives or why it was removed from the 2.0 APIs? |
@av8ramit Building from source might be an issue. In principle, I have nothing against it. However in this case we would it in one of the core APIs of Tensorflow. We would like to use it in the TF-TRT APIs ( And we can't really ask each TF-TRT user to build TF from source ... Btw. Kuddos to the team who implemented this API, very nicely put together ;) |
Graph transforms were removed and meant to be replaced by Grappler according to this RFC: @petewarden, @rmlarsen do you know if there is an alternative for this usecase (pre-process graph before inference with SavedModel)? |
Sorry @DEKHTIARJonathan I am not the best person to answer this (I was looped in in the event this was a pybind export issue), but I'll leave it to Pete and Rasmus to hopefully shed some more light. |
@annarev let me give you a crude of what I could be interested in doing if that could help: transforms = [
"remove_nodes(op=Identity, op=CheckNumerics, op=StopGradient, op=Placeholder)",
"sort_by_execution_order",
"remove_attribute(attribute_name=_XlaSeparateCompiledGradients)",
"remove_attribute(attribute_name=_XlaCompile)",
"remove_attribute(attribute_name=_XlaScope)",
"sort_by_execution_order",
'merge_duplicate_nodes',
"sort_by_execution_order",
'strip_unused_nodes',
"sort_by_execution_order",
'fold_constants(ignore_errors=true)',
"sort_by_execution_order",
'fold_batch_norms',
"sort_by_execution_order",
]
print("Applying Graph Transformations ...")
return TransformGraph(
graph_def,
input_node_names, # an array of the input node(s)
output_node_names, # an array of output nodes
transforms
) The order of execution is important. Is there any way to order grappler optimization passes in case I find a way to use the grappler ? |
then how to use the transforms in grappler optimization? |
Has any progress been made on this? Anybody find a fix? |
@rohan100jain, should these files be added back in the pip package? |
@DEKHTIARJonathan I no longer work on this project, unfortunately. Good luck! |
…pting repo: https://github.com/Saafke/FSRCNN_Tensorflow but problems using tf2 instead of tf1: tensorflow/tensorflow#43688
Issue
When using the latest TF2 release and latest available container (
2.3.1
at the time of writing), it appears that the following API is missing:Which used to be available in TF1 (https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms).
Though it doesn't make much of a sense since Tensorflow 2 ship with the C++ library associated:
Motivation
This function is very useful to pre-process and "clean" the graph before inference when using a SavedModel (namely for TF-TRT, could also maybe concerns TF Serving or TF Lite, I didn't check).
Any chance to have this API (or a replacement) back in the TF API ? I understand that TF2 is eager mode oriented, though the SavedModel format is a graph format ... So, would makes sense to keep this API in the mix since the SavedModel format is still actively used and supported in TF2.
CC: @sanjoy @reedwm
The text was updated successfully, but these errors were encountered: