Skip to content

Commit c60c5ee

Browse files
authored
Remove extract_sub_graph function from tf_optimize method because it is not needed. (#2051)
Signed-off-by: Jay Zhang <[email protected]>
1 parent a82a29e commit c60c5ee

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

tf2onnx/tf_loader.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
7474
tf_gfile = tf.io.gfile
7575
tf_placeholder = tf.compat.v1.placeholder
7676
tf_placeholder_with_default = tf.compat.v1.placeholder_with_default
77-
extract_sub_graph = tf.compat.v1.graph_util.extract_sub_graph
7877
elif Version(tf.__version__) >= Version("1.13"):
7978
# 1.13 introduced the compat namespace
8079
tf_reset_default_graph = tf.compat.v1.reset_default_graph
@@ -85,7 +84,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
8584
tf_gfile = tf.gfile
8685
tf_placeholder = tf.compat.v1.placeholder
8786
tf_placeholder_with_default = tf.compat.v1.placeholder_with_default
88-
extract_sub_graph = tf.compat.v1.graph_util.extract_sub_graph
8987
else:
9088
# older than 1.13
9189
tf_reset_default_graph = tf.reset_default_graph
@@ -96,7 +94,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
9694
tf_gfile = tf.gfile
9795
tf_placeholder = tf.placeholder
9896
tf_placeholder_with_default = tf.placeholder_with_default
99-
extract_sub_graph = tf.graph_util.extract_sub_graph
10097

10198

10299
def inputs_without_resource(sess, input_names):
@@ -709,11 +706,6 @@ def tf_optimize(input_names, output_names, graph_def):
709706
assert isinstance(input_names, list)
710707
assert isinstance(output_names, list)
711708

712-
# TODO: is this needed ?
713-
needed_names = [utils.node_name(i) for i in input_names] + \
714-
[utils.node_name(i) for i in output_names]
715-
graph_def = extract_sub_graph(graph_def, needed_names)
716-
717709
want_grappler = is_tf2() or Version(tf.__version__) >= Version("1.15")
718710
if want_grappler:
719711
graph_def = tf_optimize_grappler(input_names, output_names, graph_def)

0 commit comments

Comments
 (0)