提交 a0684973 authored 作者: Frederic's avatar Frederic

Fix theano.grad() verification of compute_test_value for op with multiple outputs.

上级 f7dacab5
...@@ -910,14 +910,14 @@ def _populate_grad_dict(var_to_app_to_idx, ...@@ -910,14 +910,14 @@ def _populate_grad_dict(var_to_app_to_idx,
if not hasattr(orig_output, 'shape'): if not hasattr(orig_output, 'shape'):
continue continue
for orig_output_v, new_output_grad_v in get_debug_values( for orig_output_v, new_output_grad_v in get_debug_values(
node.outputs, new_output_grads): *packed):
o_shape = orig_output_v.shape o_shape = orig_output_v.shape
g_shape = new_output_grad_v.shape g_shape = new_output_grad_v.shape
if o_shape != g_shape: if o_shape != g_shape:
raise ValueError("Got a gradient of shape " + \ raise ValueError(
str(o_shape) + " on an output of shape " + \ "Got a gradient of shape " +
str(g_shape)) str(o_shape) + " on an output of shape " +
str(g_shape))
input_grads = node.op.grad(inputs, new_output_grads) input_grads = node.op.grad(inputs, new_output_grads)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论