提交 bf256736 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

implemented __eq__ and __hash__ for Elemwise

上级 3357f441
...@@ -272,6 +272,12 @@ class Elemwise(Op): ...@@ -272,6 +272,12 @@ class Elemwise(Op):
outputs = [Tensor(dtype = dtype, broadcastable = broadcastable)() for dtype, broadcastable in zip(out_dtypes, out_broadcastables)] outputs = [Tensor(dtype = dtype, broadcastable = broadcastable)() for dtype, broadcastable in zip(out_dtypes, out_broadcastables)]
return Apply(self, inputs, outputs) return Apply(self, inputs, outputs)
def __eq__(self, other):
return type(self) == type(other) and self.scalar_op == other.scalar_op and self.inplace_pattern == other.inplace_pattern
def __hash__(self):
return hash(self.scalar_op) ^ hash(self.inplace_pattern)
def __str__(self): def __str__(self):
if self.name is None: if self.name is None:
if self.inplace_pattern: if self.inplace_pattern:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论