提交 95938fe8 authored 作者: Frederic's avatar Frederic

Fix the case where local_subtensor_of_alloc wasn't computing the right…

Fix the case where local_subtensor_of_alloc wasn't computing the right broadcastable. It was due to a wrong broadcastable in Subtensor.make_node()
上级 9df5e50b
......@@ -2014,9 +2014,6 @@ def local_subtensor_of_alloc(node):
rval = T.alloc(nw_val, *nw_dims)
if type(rval) not in (list, tuple):
rval = [rval]
if rval[0].type != node.outputs[0].type:
#This happen from time to time, we need to discover why
return
return rval
......
......@@ -393,8 +393,15 @@ class Subtensor(Op):
# infer the broadcasting pattern
padded = (idx_list
+ [slice(None, None, None)] * (x.type.ndim - len(idx_list)))
broadcastable = [bc for p, bc in izip(padded, x.type.broadcastable)
if isinstance(p, slice)]
broadcastable = [bc and p.start is None and p.stop is None
# No need to check step when there is only
# one element and start and stop are None,
# the output will always have 1 element.
# We could call get_canonical_form_slice() to
# catch more broadcast case. I let this to
# later.
for p, bc in izip(padded, x.type.broadcastable)
if isinstance(p, slice)]
input_types = Subtensor.collapse(idx_list,
lambda entry: isinstance(entry, gof.Type))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论