提交 53c41019 authored 作者: James Bergstra's avatar James Bergstra

fixed canonizer bug with broadcasting

上级 4b16dc1f
...@@ -715,21 +715,17 @@ class Canonizer(gof.LocalOptimizer): ...@@ -715,21 +715,17 @@ class Canonizer(gof.LocalOptimizer):
elem_op = T.Elemwise(scalar.Identity(scalar.specific_out(getattr(scalar, out.type.dtype)))) elem_op = T.Elemwise(scalar.Identity(scalar.specific_out(getattr(scalar, out.type.dtype))))
new = elem_op(new) new = elem_op(new)
if new.type.broadcastable != out.type.broadcastable: if new.type != out.type:
new = T.fill(out, new) for x in orig_num + orig_denum:
if x.type == out.type:
if 0: new = T.fill(x, new)
print 'BEFORE' break
_debugprint(out, ' ', depth=4)
print 'AFTER'
_debugprint(new, ' ', depth=4)
# if our if's above worked, this should be true. OTW investigate.
if new.type != out.type: if new.type != out.type:
print >> sys.stderr, 'CANONIZE FAILED: new, out = ', new, ',', out, 'types', new.type, ',', out.type print >> sys.stderr, 'CANONIZE FAILED: new, out = ', new, ',', out, 'types', new.type, ',', out.type
assert new.type == out.type return False
else:
return [new] return [new]
def __str__(self): def __str__(self):
return getattr(self, 'name', 'Canonizer(%s, %s, %s)' % (self.main, self.inverse, self.reciprocal)) return getattr(self, 'name', 'Canonizer(%s, %s, %s)' % (self.main, self.inverse, self.reciprocal))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论