提交 2d09814e authored 作者: --global's avatar --global

Don't push out the outputs of an 'as_while' Scan

上级 c89e1bc2
...@@ -612,8 +612,11 @@ class PushOutScanOutput(gof.Optimizer): ...@@ -612,8 +612,11 @@ class PushOutScanOutput(gof.Optimizer):
fgraph.attach_feature(gof.toolbox.ReplaceValidate()) fgraph.attach_feature(gof.toolbox.ReplaceValidate())
def apply(self, fgraph): def apply(self, fgraph):
# Don't perform the optimization on as_while scans since it's
# impossible to know for how many steps it will run.
nodelist = [x for x in fgraph.toposort() nodelist = [x for x in fgraph.toposort()
if isinstance(x.op, scan_op.Scan)] if (isinstance(x.op, scan_op.Scan) and
not x.op.as_while]
for node in nodelist: for node in nodelist:
# Process the node as long as something gets optimized # Process the node as long as something gets optimized
while node != None: while node != None:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论