提交 291c2019 authored 作者: James Bergstra's avatar James Bergstra

tensor.grad - added explicit list cast

上级 32b58ff4
...@@ -3886,7 +3886,9 @@ def grad(cost, wrt, g_cost=None, consider_constant=[], warn_type=False): ...@@ -3886,7 +3886,9 @@ def grad(cost, wrt, g_cost=None, consider_constant=[], warn_type=False):
if g_cost is None: if g_cost is None:
g_cost = ones_like(cost) g_cost = ones_like(cost)
inputs = gof.graph.inputs([cost]) inputs = gof.graph.inputs([cost])
gmap = gradient.grad_sources_inputs([(cost, g_cost)], inputs + consider_constant, gmap = gradient.grad_sources_inputs(
[(cost, g_cost)],
list(inputs) + list(consider_constant),
warn_type=warn_type) warn_type=warn_type)
# Note that it is important to use `zeros_like` when there is no gradient, # Note that it is important to use `zeros_like` when there is no gradient,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论