提交 b862796c authored 作者: Frederic's avatar Frederic 提交者: Ian Goodfellow

fix gh-787 error that appear in this PR too.

上级 79c3a5f1
...@@ -2832,16 +2832,16 @@ class Canonizer(gof.LocalOptimizer): ...@@ -2832,16 +2832,16 @@ class Canonizer(gof.LocalOptimizer):
# this canonized graph... if so, we do nothing and wait for # this canonized graph... if so, we do nothing and wait for
# them to be transformed. # them to be transformed.
def _bypass_dimshuffle(n): def _bypass_dimshuffle(n):
if isinstance(n.op, DimShuffle) and len(n.outputs[0].clients) <= 1: if (isinstance(getattr(n, 'op', None), DimShuffle) and
return _bypass_dimshuffle(n.outputs[0].clients.__iter__( len(n.outputs[0].clients) <= 1):
).next()[0]) return _bypass_dimshuffle(n.outputs[0].clients[0][0])
else: else:
return n return n
for c, c_idx in out.clients: for c, c_idx in out.clients:
if c == 'output': if c == 'output':
continue continue
if _bypass_dimshuffle(c).op in [self.main, self.inverse, if getattr(_bypass_dimshuffle(c), 'op', '') in [
self.reciprocal]: self.main, self.inverse, self.reciprocal]:
return False return False
# Here we make the canonical version of the graph around this node # Here we make the canonical version of the graph around this node
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论