提交 edeb15ad authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Comment regarding the strange use of indexing after it was asked in the code

review.
上级 c5a52e25
...@@ -850,6 +850,16 @@ class Scan(PureOp): ...@@ -850,6 +850,16 @@ class Scan(PureOp):
# if optimization gets applied compared to when optimization # if optimization gets applied compared to when optimization
# do not get applied # do not get applied
if i < n_steps: if i < n_steps:
# The reason I don't use out[idx][0][:i] is because for
# certain outputs (those with multiple taps),
# outs[idx][0] has more then n_steps entries, with the
# initial state at the begining. When indexing in it I
# usually have to do something like
# outs[idx][0][i+offset]. To do something similar here,
# I would have first to compute the maximal tap for
# every output and then do outs[0][:i+maximal_tap],
# which implies I think more computations then this
# little trick that I used
outs[idx][0] = outs[idx][0][:-(n_steps - i)] outs[idx][0] = outs[idx][0][:-(n_steps - i)]
t_call = time.time() - t0_call t_call = time.time() - t0_call
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论