Speed up determined_sort which speeds up emitting the IR (#4928)
This commit is contained in:
parent
da7c2dfc2b
commit
851e203f72
@ -40,12 +40,11 @@ def determined_sort(outputs: list):
|
|||||||
stack = list(outputs)
|
stack = list(outputs)
|
||||||
visited = set()
|
visited = set()
|
||||||
while len(stack) != 0:
|
while len(stack) != 0:
|
||||||
node = stack[0]
|
node = stack.pop(0)
|
||||||
node_id = node.id
|
node_id = node.id
|
||||||
stack.pop(0)
|
|
||||||
visited.add(node_id)
|
visited.add(node_id)
|
||||||
has_child = False
|
has_child = False
|
||||||
in_names = [n.id if isinstance(node.in_nodes(), list) else node.in_node(n).id for n in node.in_nodes()]
|
in_names = [n for n, d in node.get_inputs()]
|
||||||
for in_node_name in in_names:
|
for in_node_name in in_names:
|
||||||
if in_node_name not in visited:
|
if in_node_name not in visited:
|
||||||
stack.insert(0, node)
|
stack.insert(0, node)
|
||||||
|
Loading…
Reference in New Issue
Block a user