Skip to content

Remove extract_sub_graph function from tf_optimize method. #2051

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

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions tf2onnx/tf_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
tf_gfile = tf.io.gfile
tf_placeholder = tf.compat.v1.placeholder
tf_placeholder_with_default = tf.compat.v1.placeholder_with_default
extract_sub_graph = tf.compat.v1.graph_util.extract_sub_graph
elif Version(tf.__version__) >= Version("1.13"):
# 1.13 introduced the compat namespace
tf_reset_default_graph = tf.compat.v1.reset_default_graph
Expand All @@ -85,7 +84,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
tf_gfile = tf.gfile
tf_placeholder = tf.compat.v1.placeholder
tf_placeholder_with_default = tf.compat.v1.placeholder_with_default
extract_sub_graph = tf.compat.v1.graph_util.extract_sub_graph
else:
# older than 1.13
tf_reset_default_graph = tf.reset_default_graph
Expand All @@ -96,7 +94,6 @@ def not_implemented_tf_placeholder(*args, **kwargs):
tf_gfile = tf.gfile
tf_placeholder = tf.placeholder
tf_placeholder_with_default = tf.placeholder_with_default
extract_sub_graph = tf.graph_util.extract_sub_graph


def inputs_without_resource(sess, input_names):
Expand Down Expand Up @@ -709,11 +706,6 @@ def tf_optimize(input_names, output_names, graph_def):
assert isinstance(input_names, list)
assert isinstance(output_names, list)

# TODO: is this needed ?
needed_names = [utils.node_name(i) for i in input_names] + \
[utils.node_name(i) for i in output_names]
graph_def = extract_sub_graph(graph_def, needed_names)

want_grappler = is_tf2() or Version(tf.__version__) >= Version("1.15")
if want_grappler:
graph_def = tf_optimize_grappler(input_names, output_names, graph_def)
Expand Down