提交 073bb19d authored 作者: goodfeli's avatar goodfeli

Merge pull request #8 from pascanur/scan_fix_int_grad

deal with the case when the grad on one output is undefined
...@@ -1305,7 +1305,13 @@ class Scan(PureOp): ...@@ -1305,7 +1305,13 @@ class Scan(PureOp):
# 7.3. compute gradients of the inputs given one output # 7.3. compute gradients of the inputs given one output
for dx, out in enumerate(clean_outputs): for dx, out in enumerate(clean_outputs):
inner_g_out = safe_new(g_outs[dx][0]) if g_outs[dx] != None:
inner_g_out = safe_new(g_outs[dx][0])
else:
# We do not have a gradient on this output so we need a
# placeholder, which for now has the same dtype as the
# output
inner_g_out = safe_new(out)
### ###
#### I need to clip the gradient HERE !! #### I need to clip the gradient HERE !!
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论