提交 def0bbbe authored 作者: James Bergstra's avatar James Bergstra

moved failing Module test to function tests and also fixed it

上级 90c45509
......@@ -287,6 +287,20 @@ class T_function(unittest.TestCase):
o = N.ones((3,3))
assert o is f(o) #borrow does not imply copy.
f = function([a], Out(a*4, borrow=False))
o = N.ones((3,3))
four = f(o)
assert numpy.all(four==4)
f(o+.1) #should not clobber the memory used to store four
assert numpy.all(four==4)
f = function([a], Out(a*4, borrow=True), mode=theano.Mode('c|py_nogc', 'fast_run'))
o = N.ones((3,3))
four = f(o)
assert numpy.all(four==4)
f(o+.1) #should clobber the memory used to store four
assert not numpy.all(four==4)
class T_picklefunction(unittest.TestCase):
def test_deepcopy(self):
......
......@@ -452,19 +452,6 @@ class T_module(unittest.TestCase):
assert numpy.all(m.f(xval) == [1, 2.5])
assert numpy.all(xval == [-1, -1.5])
def test_member_output_flags(self):
"""Test that we can manipulate the output flags (just 'borrow' I think, see SymbolicOutput)
of Method outputs"""
M = Module()
M.x = T.dvector()
M.f = Method([M.x], io.Out(M.x*4, borrow=True), mode='FAST_RUN')
m = M.make()
v0 = m.f([5, 8])
v0_copy = v0 * 1
m.f([3, 2])
assert numpy.all(v0 != v0_copy)
def test_member_value(self):
"""Test that module Members of Value work correctly. As Variable?"""
M = Module()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论