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

deal with undefined grads

上级 3299fe59
......@@ -1312,8 +1312,14 @@ class Scan(PureOp):
connection_pattern[iidx+1][oidx] = True
else:
for inner_out in ols:
tmp = compute_gradient(
inner_out, safe_new(inner_out, dtype='float64'), ils)
if hasattr(inner_out, 'dtype'):
tmp = compute_gradient(
inner_out,
safe_new(inner_out, dtype='float64'),
ils)
else:
# It should be undefined not disconnected
tmp = ils
if any([x is not None for x in tmp]):
connection_pattern[iidx+1][oidx] = True
return connection_pattern
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论