提交 b0324504 authored 作者: Frederic's avatar Frederic

Make a op class pickable by being at the top level of the module.

This is needed to cache the c code.
上级 37dbae29
...@@ -559,9 +559,7 @@ class Test_check_isfinite(unittest.TestCase): ...@@ -559,9 +559,7 @@ class Test_check_isfinite(unittest.TestCase):
return return
class Test_preallocated_output(unittest.TestCase): class BrokenCImplementationAdd(gof.Op):
class BrokenCImplementationAdd(gof.Op):
def __eq__(self, other): def __eq__(self, other):
return type(self) == type(other) return type(self) == type(other)
...@@ -652,10 +650,13 @@ class Test_preallocated_output(unittest.TestCase): ...@@ -652,10 +650,13 @@ class Test_preallocated_output(unittest.TestCase):
} }
""" % dict(locals(), **sub) """ % dict(locals(), **sub)
class Test_preallocated_output(unittest.TestCase):
def test_f_contiguous(self): def test_f_contiguous(self):
a = theano.tensor.fmatrix('a') a = theano.tensor.fmatrix('a')
b = theano.tensor.fmatrix('b') b = theano.tensor.fmatrix('b')
z = self.BrokenCImplementationAdd()(a, b) z = BrokenCImplementationAdd()(a, b)
# Needed so that z is not the output of the graph # Needed so that z is not the output of the graph
out = theano.tensor.dot(z, numpy.eye(7)) out = theano.tensor.dot(z, numpy.eye(7))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论