提交 4577347b authored 作者: Iban Harlouchet's avatar Iban Harlouchet

__props__ for theano/compile/tests/test_debugmode.py

上级 c89e1bc2
...@@ -20,17 +20,13 @@ def test0(): ...@@ -20,17 +20,13 @@ def test0():
class BROKEN_ON_PURPOSE_Add(gof.Op): class BROKEN_ON_PURPOSE_Add(gof.Op):
__props__ = ("py_offset",)
def __init__(self, py_offset): def __init__(self, py_offset):
gof.Op.__init__(self) gof.Op.__init__(self)
self.py_offset = py_offset self.py_offset = py_offset
def __eq__(self, other):
return (type(self) == type(other) and
(self.py_offset == other.py_offset))
def __hash__(self):
return 29834 ^ hash(type(self)) ^ hash(self.py_offset)
def make_node(self, a, b): def make_node(self, a, b):
a = theano.tensor.as_tensor_variable(a) a = theano.tensor.as_tensor_variable(a)
b = theano.tensor.as_tensor_variable(b) b = theano.tensor.as_tensor_variable(b)
...@@ -105,17 +101,12 @@ class WeirdBrokenOp(gof.Op): ...@@ -105,17 +101,12 @@ class WeirdBrokenOp(gof.Op):
In both cases, it does not set the destroy_map or view_map correctly so In both cases, it does not set the destroy_map or view_map correctly so
it should raise an error in DebugMode. it should raise an error in DebugMode.
""" """
__props__ = ("behaviour", )
def __init__(self, behaviour): def __init__(self, behaviour):
gof.Op.__init__(self) gof.Op.__init__(self)
self.behaviour = behaviour self.behaviour = behaviour
def __eq__(self, other):
return (type(self) == type(other)
and (self.behaviour == other.behaviour))
def __hash__(self):
return hash(type(self)) ^ hash(self.behaviour)
def make_node(self, a): def make_node(self, a):
a_ = theano.tensor.as_tensor_variable(a) a_ = theano.tensor.as_tensor_variable(a)
r = gof.Apply(self, [a_], [a_.type()]) r = gof.Apply(self, [a_], [a_.type()])
...@@ -605,11 +596,8 @@ class Test_check_isfinite(unittest.TestCase): ...@@ -605,11 +596,8 @@ class Test_check_isfinite(unittest.TestCase):
class BrokenCImplementationAdd(gof.Op): class BrokenCImplementationAdd(gof.Op):
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self): __props__ = ()
return hash(type(self))
def make_node(self, a, b): def make_node(self, a, b):
a = theano.tensor.as_tensor_variable(a) a = theano.tensor.as_tensor_variable(a)
...@@ -703,12 +691,7 @@ class VecAsRowAndCol(gof.Op): ...@@ -703,12 +691,7 @@ class VecAsRowAndCol(gof.Op):
This Op exists to check everything is correct when an Op has This Op exists to check everything is correct when an Op has
two outputs with different broadcasting patterns. two outputs with different broadcasting patterns.
""" """
__props__ = ()
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def make_node(self, v): def make_node(self, v):
if not isinstance(v, gof.Variable): if not isinstance(v, gof.Variable):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论