提交 5ea4d31c authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed bug where known_grads were treated as Disconnected if included in

wrt
上级 80f18e40
...@@ -506,7 +506,8 @@ def grad(cost, wrt, g_cost=None, consider_constant=None, ...@@ -506,7 +506,8 @@ def grad(cost, wrt, g_cost=None, consider_constant=None,
# so that wrt not being in var_to_node_to_idx won't cause an error below # so that wrt not being in var_to_node_to_idx won't cause an error below
# according to the flag, possibly raise an error if wrt is disconnected # according to the flag, possibly raise an error if wrt is disconnected
for elem in wrt: for elem in wrt:
if elem not in var_to_node_to_idx and elem is not cost: if elem not in var_to_node_to_idx and elem is not cost \
and elem not in grad_dict:
message = ("grad method was asked to compute the gradient " message = ("grad method was asked to compute the gradient "
"with respect to a variable that is not part of " "with respect to a variable that is not part of "
"the computational graph of the cost, or is used " "the computational graph of the cost, or is used "
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论