提交 8840e04f authored 作者: Matthew Rocklin's avatar Matthew Rocklin

add tags and type to hash methods in io.py

上级 3eeae2a2
...@@ -30,7 +30,7 @@ class LoadFromDisk(Op): ...@@ -30,7 +30,7 @@ class LoadFromDisk(Op):
return (type(self) == type(other) and self._info == other._info) return (type(self) == type(other) and self._info == other._info)
def __hash__(self): def __hash__(self):
return hash(self._info) return hash((type(self),) + self._info)
def make_node(self, path): def make_node(self, path):
if isinstance(path, str): if isinstance(path, str):
...@@ -114,7 +114,7 @@ class MPIRecv(Op): ...@@ -114,7 +114,7 @@ class MPIRecv(Op):
return (type(self) == type(other) and self._info == other._info) return (type(self) == type(other) and self._info == other._info)
def __hash__(self): def __hash__(self):
return hash(self._info) return hash((type(self),) + self._info)
def make_node(self): def make_node(self):
return gof.Apply(self, [], [theano.Variable(Generic()), return gof.Apply(self, [], [theano.Variable(Generic()),
...@@ -154,7 +154,7 @@ class MPIRecvWait(Op): ...@@ -154,7 +154,7 @@ class MPIRecvWait(Op):
return type(self) == type(other) and self.tag == other.tag return type(self) == type(other) and self.tag == other.tag
def __hash__(self): def __hash__(self):
return hash(type(self)) return hash((type(self), self.tag))
def make_node(self, request, data): def make_node(self, request, data):
return gof.Apply(self, [request, data], return gof.Apply(self, [request, data],
...@@ -197,7 +197,7 @@ class MPISend(Op): ...@@ -197,7 +197,7 @@ class MPISend(Op):
return (type(self) == type(other) and self._info == other._info) return (type(self) == type(other) and self._info == other._info)
def __hash__(self): def __hash__(self):
return hash(self._info) return hash((type(self),) + self._info)
def make_node(self, data): def make_node(self, data):
return gof.Apply(self, [data], return gof.Apply(self, [data],
...@@ -231,7 +231,7 @@ class MPISendWait(Op): ...@@ -231,7 +231,7 @@ class MPISendWait(Op):
return type(self) == type(other) and self.tag == other.tag return type(self) == type(other) and self.tag == other.tag
def __hash__(self): def __hash__(self):
return hash(type(self)) return hash((type(self), self.tag))
def make_node(self, request): def make_node(self, request):
return gof.Apply(self, [request], return gof.Apply(self, [request],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论