提交 915ccd0f authored 作者: James Bergstra's avatar James Bergstra

added eq and hash to tensordot

上级 216e514a
......@@ -1994,6 +1994,12 @@ class TensorDotGrad(Op):
def __init__(self, axes):
self.axes = axes;
def __eq__(self, other):
return type(self) == type(other) and self.axes == other.axes
def __hash__(self):
return hash(type(self)) ^ hash(self.axes) ^ 89234
def make_node(self, x, y, gz):
assert isinstance(x, Result)
assert isinstance(y, Result)
......@@ -2033,6 +2039,12 @@ class TensorDot(Op):
def __init__(self, axes):
self.axes = axes;
def __eq__(self, other):
return type(self) == type(other) and self.axes == other.axes
def __hash__(self):
return hash(type(self)) ^ hash(self.axes) ^ 89234
def make_node(self, x, y):
axesdim = numpy.size(self.axes)/2
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论