wx3000 commented on a change in pull request #7498:
URL: https://github.com/apache/tvm/pull/7498#discussion_r580714263



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -3682,6 +3729,30 @@ def from_tensorflow(graph, layout="NHWC", shape=None, 
outputs=None):
     params : dict of str to tvm.nd.NDArray
         Dict of converted parameters stored in tvm.nd.NDArray format
     """
+    from tensorflow.python.eager.function import ConcreteFunction
+
+    if isinstance(graph, ConcreteFunction):
+        try:
+            from tensorflow.python.framework import convert_to_constants
+            from tensorflow.core.protobuf import config_pb2
+        except ImportError as e:
+            raise ImportError("Unable to import tensorflow which is required 
{}".format(e))
+        concrete_func = graph
+        graph = 
convert_to_constants.convert_variables_to_constants_v2(concrete_func).graph
+        signature = _build_signature_def(graph, concrete_func.inputs, 
concrete_func.outputs)
+        graph_def = graph.as_graph_def()
+
+        # Some optimization
+        config = config_pb2.ConfigProto()
+        rewriter_config = config.graph_options.rewrite_options
+        rewriter_config.optimizers[:] = [
+            "debug_stripper",
+            "arithmetic",
+            "dependency",
+            "arithmetic",

Review comment:
       is line 3752 a duplicate of line 3750? 
   
   It appears that "arithmetic" and "dependency" optimizations may be ON by 
default, while "debug_stripper" is OFF by default:  
https://www.tensorflow.org/guide/graph_optimization. I have not verified this. 
Are these required?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to