提交 6a0b74bc authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Fix bug in scan op when behaving like an while

I will push a test for this latter today ..
上级 46865976
...@@ -842,7 +842,15 @@ class Scan(PureOp): ...@@ -842,7 +842,15 @@ class Scan(PureOp):
# not actually computed # not actually computed
elif store_steps[idx] > i - self.mintaps[idx]: elif store_steps[idx] > i - self.mintaps[idx]:
outs[idx][0][i-self.mintaps[idx]:] = 0 outs[idx][0][i-self.mintaps[idx]:] = 0
# This is a fix for a bug introduced by while. If you say
# you want to loop up to a condition, you expect the output
# to have that length ( and not the maximal length possible)
#
# Without this the behaviour of a scan op is not consistent
# if optimization gets applied compared to when optimization
# do not get applied
if i < n_steps:
outs[idx][0] = outs[idx][0][:-(n_steps - i)]
t_call = time.time() - t0_call t_call = time.time() - t0_call
# NOTE: make this match what's in function_module.Function # NOTE: make this match what's in function_module.Function
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论