提交 47bf892b authored 作者: Frederic Bastien's avatar Frederic Bastien

Better comment/doc

上级 29a3778d
...@@ -1382,12 +1382,13 @@ def is_in_ancestors(l_node, f_node): ...@@ -1382,12 +1382,13 @@ def is_in_ancestors(l_node, f_node):
Goes up in the graph and returns True if the apply node f_node is found. Goes up in the graph and returns True if the apply node f_node is found.
Use a stack implementation as the vm algo. Use a stack implementation as the vm algo.
We suppose all nodes are not lazy
(i.e. for IfElse we suppose all inputs are computed)
""" """
computed = set() computed = set()
todo = [l_node] todo = [l_node]
while todo: while todo:
cur = todo.pop() cur = todo.pop()
# We suppose that all outputs are always computed
if cur.outputs[0] in computed: if cur.outputs[0] in computed:
continue continue
if all([i in computed or i.owner is None for i in cur.inputs]): if all([i in computed or i.owner is None for i in cur.inputs]):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论