提交 d27f2398 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix bug in get_scalar_constant value of Subtensor(Shape(Rebroadcast(v)))

The inner loop that would update the broadcastable pattern according to the rebroadcast dict would overwrite the idx extracted from the Subtensor, thus always selecting the last dim.
上级 02c218fa
......@@ -712,11 +712,9 @@ def get_scalar_constant_value(orig_v, elemwise=True,
ndim = grandparent.type.ndim
if grandparent.owner and isinstance(grandparent.owner.op,
Rebroadcast):
l = []
for idx, (b1, b2) in enumerate(
zip(grandparent.owner.inputs[0].broadcastable,
gp_broadcastable)):
l.append(b1 or b2)
ggp_broadcastable = grandparent.owner.inputs[0].broadcastable
l = [b1 or b2 for b1, b2 in zip(ggp_broadcastable,
gp_broadcastable)]
gp_broadcastable = tuple(l)
assert ndim == len(gp_broadcastable)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论