提交 90beebe3 authored 作者: Frederic Bastien's avatar Frederic Bastien

Started to make test_lazy.py work in DebugMode

上级 eba84948
...@@ -84,6 +84,11 @@ class IfElseIfElseIf(PureOp): ...@@ -84,6 +84,11 @@ class IfElseIfElseIf(PureOp):
class NotImplementedOp(PureOp): class NotImplementedOp(PureOp):
class E(Exception): pass class E(Exception): pass
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def make_node(self, x): def make_node(self, x):
return Apply(self, [x], [x.type()]) return Apply(self, [x], [x.type()])
def make_thunk(self, node, storage_map, compute_map, no_recycling): def make_thunk(self, node, storage_map, compute_map, no_recycling):
......
...@@ -50,10 +50,29 @@ class IfElse(PureOp): ...@@ -50,10 +50,29 @@ class IfElse(PureOp):
view_map[0] = [1] view_map[0] = [1]
self.view_map = view_map self.view_map = view_map
#raise NotImplementedError('IfElse must copy for now') #raise NotImplementedError('IfElse must copy for now')
else:
self.view_map = {}
self.as_view=as_view self.as_view=as_view
self.gpu = gpu self.gpu = gpu
self.name = name self.name = name
def __eq__(self, other):
return (type(self)==type(other) and
self.as_view == other.as_view and
# view_map included in as_view
#self.view_map == other.view_map and
self.gpu == other.gpu and
self.name == other.name)
def __eq__(self, other):
return (hash(type(self)) ^
# view_map included in as_view
# and dict are not hashable
#hash(self.view_map) ^
hash(self.as_view) ^
hash(self.gpu) ^
hash(self.name))
def make_node(self, c, t, f): def make_node(self, c, t, f):
if t.type != f.type: if t.type != f.type:
raise TypeError( raise TypeError(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论