Remove unneeded lines.

There's no need to keep a separate set to track the seen nodes (`visited_nodes` because `path` is already effectively filtering out the duplicate nodes)

PiperOrigin-RevId: 351235385
Change-Id: I5004076b6b3e32d70261b3af04a4872236034887
This commit is contained in:
Katherine Wu 2021-01-11 14:24:05 -08:00 committed by TensorFlower Gardener
parent 986d13e168
commit 6dc9dc2334

View File

@ -204,13 +204,9 @@ def _generate_object_paths(object_graph_def):
"""Traverses through an ObjectGraphDef and builds a map of all node paths."""
paths = {0: 'root'}
nodes_to_visit = [0]
visited_nodes = set([])
while nodes_to_visit:
current_node = nodes_to_visit.pop()
# if current_node in visited_nodes:
# continue
visited_nodes.add(current_node)
current_path = paths[current_node]
for reference in object_graph_def.nodes[current_node].children:
if reference.node_id in paths: