提交 56bb06eb authored 作者: --global's avatar --global

Prevent ScanSaveMem from generating 0-steps scans

上级 079181cf
...@@ -1258,6 +1258,14 @@ class ScanSaveMem(gof.Optimizer): ...@@ -1258,6 +1258,14 @@ class ScanSaveMem(gof.Optimizer):
real_steps = None real_steps = None
nw_steps = select_min(select_max(sym_steps, real_steps), nw_steps = select_min(select_max(sym_steps, real_steps),
node.inputs[0]) node.inputs[0])
# Make sure the ScanSaveMem optimization never makes the new
# number of steps to be 0 (this could happen, for instance, if
# the optimization detects that the outputs of the Scan go through
# subtensor nodes that end up taking no elements) because Scan with
# 0 iterations are not supported. Make sure the new number of steps
# is at least 1.
nw_steps = select_max(nw_steps, 1)
else: else:
nw_steps = node.inputs[0] nw_steps = node.inputs[0]
global_nsteps = None global_nsteps = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论