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

compile module - updated tests to reflect .value copy semantics

上级 91253065
...@@ -285,7 +285,7 @@ class T_function(unittest.TestCase): ...@@ -285,7 +285,7 @@ class T_function(unittest.TestCase):
a = T.dmatrix() a = T.dmatrix()
f = function([a], Out(a, borrow=False)) f = function([a], Out(a, borrow=False))
o = N.ones((3,3)) o = N.ones((3,3))
assert o is f(o) #borrow does not imply copy. assert o is not f(o) #function no longer permits aliasing outputs to inputs
f = function([a], Out(a*4, borrow=False)) f = function([a], Out(a*4, borrow=False))
o = N.ones((3,3)) o = N.ones((3,3))
......
...@@ -107,8 +107,8 @@ class Test_SharedVariable(unittest.TestCase): ...@@ -107,8 +107,8 @@ class Test_SharedVariable(unittest.TestCase):
# check that an assignment of a perfect value results in no copying # check that an assignment of a perfect value results in no copying
uval = theano._asarray([5,6,7,8], dtype='float64') uval = theano._asarray([5,6,7,8], dtype='float64')
u.value = uval u.set_value(uval, borrow=True)
assert u.value is uval assert u.get_value(borrow=True) is uval
def test_scalar_strict(self): def test_scalar_strict(self):
def f(var, val): var.value = val def f(var, val): var.value = val
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论