提交 cadf299c authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed __eq__ and __hash__ of Diagonal Op

上级 b412823a
...@@ -7251,10 +7251,14 @@ class Diagonal(Op): ...@@ -7251,10 +7251,14 @@ class Diagonal(Op):
self.axis2 = axis2 self.axis2 = axis2
def __eq__(self, other): def __eq__(self, other):
return (type(self) == type(other)) return (type(self) == type(other) and
self.offset == other.offset and
self.axis1 == other.axis1 and
self.axis2 == other.axis2)
def __hash__(self): def __hash__(self):
return hash(type(self)) return (hash(type(self)) ^ hash(self.offset) ^
hash(self.axis1) ^ hash(self.axis2))
def make_node(self, x): def make_node(self, x):
x = as_tensor_variable(x) x = as_tensor_variable(x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论