提交 7b5838d7 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

fix for random states

we should have as initial value for some parameter 0, unless it is a random state, case in which is not differentiable and should be None
上级 c37e8c25
...@@ -289,7 +289,12 @@ def Rop(f, wrt, eval_points): ...@@ -289,7 +289,12 @@ def Rop(f, wrt, eval_points):
if inp in wrt: if inp in wrt:
local_eval_points.append(eval_points[wrt.index(inp)]) local_eval_points.append(eval_points[wrt.index(inp)])
elif inp.owner is None: elif inp.owner is None:
local_eval_points.append(inp.zeros_like()) try:
local_eval_points.append(inp.zeros_like())
except:
# None should be used for non-differentiable
# arguments, like for example random states
local_eval_points.append(None)
elif inp.owner in seen_nodes: elif inp.owner in seen_nodes:
local_eval_points.append( local_eval_points.append(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论