diff --git a/mace/python/tools/converter_tool/tensorflow_converter.py b/mace/python/tools/converter_tool/tensorflow_converter.py index 9390d5a11af62f2b9cbbe55f2c98ecd4b23ed1a8..825c3c000431895a2ad7443f4aeaeb2211b06e18 100644 --- a/mace/python/tools/converter_tool/tensorflow_converter.py +++ b/mace/python/tools/converter_tool/tensorflow_converter.py @@ -271,11 +271,15 @@ class TensorflowConverter(base_converter.ConverterInterface): print("Run transform_graph: %s" % TFTransformGraphOptions[ option.device]) - transformed_graph_def = TransformGraph(tf_graph_def, - option.input_nodes.keys(), - option.output_nodes.keys(), - TFTransformGraphOptions[ - option.device]) + try: + transformed_graph_def = TransformGraph(tf_graph_def, + option.input_nodes.keys(), + option.output_nodes.keys(), + TFTransformGraphOptions[ + option.device]) + except Exception as ex: + print("Failed to transform graph using tf tool: %s" % ex) + transformed_graph_def = tf_graph_def with tf.Session() as session: with session.graph.as_default() as graph: