提交 2d8be02e authored 作者: Olivier Breuleux's avatar Olivier Breuleux

fixed CAReduce.__hash__

上级 27270d63
...@@ -520,7 +520,10 @@ class CAReduce(Op): ...@@ -520,7 +520,10 @@ class CAReduce(Op):
return type(self) == type(other) and self.scalar_op == other.scalar_op and self.axis == other.axis return type(self) == type(other) and self.scalar_op == other.scalar_op and self.axis == other.axis
def __hash__(self): def __hash__(self):
return hash(self.scalar_op) ^ hash(self.axis) if self.axis is None:
return hash(self.scalar_op)
else:
return hash(self.scalar_op) ^ hash(tuple(self.axis))
def __str__(self): def __str__(self):
if self.axis is not None: if self.axis is not None:
......
...@@ -821,8 +821,8 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -821,8 +821,8 @@ class OpWiseCLinker(link.LocalLinker):
try: try:
cl = self.__cache__.get(desc) cl = self.__cache__.get(desc)
except: except Exception, exc:
print "harmless warning: failed to hash %s" % node print "harmless warning: failed to hash %s: %s" % (node, exc)
cl = None cl = None
if cl is None: if cl is None:
cl = CLinker().accept(e, [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling]) cl = CLinker().accept(e, [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论