提交 f0a3f06c authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Expand ~ in base_compiledir. clean-up after tests.

上级 e76dbade
......@@ -4,21 +4,32 @@ from theano import tensor, function, Variable, Generic
import numpy
import os
class T_load_tensor(unittest.TestCase):
def test0(self):
data = numpy.arange(5, dtype=numpy.int32)
filename = os.path.join(theano.config.base_compiledir, "_test.npy")
filename = os.path.join(
os.path.expanduser(theano.config.base_compiledir),
"_test.npy")
numpy.save(filename, data)
path = Variable(Generic())
x = tensor.load(path, 'int32', (False,))
y = x*2
fn = function([path], y)
assert (fn(filename) == data*2).all()
def test_memmap(self):
data = numpy.arange(5, dtype=numpy.int32)
filename = os.path.join(theano.config.base_compiledir, "_test.npy")
filename = os.path.join(
os.path.expanduser(theano.config.base_compiledir),
"_test.npy")
numpy.save(filename, data)
path = Variable(Generic())
x = tensor.load(path, 'int32', (False,), mmap_mode='r+')
fn = function([path], x)
assert type(fn(filename)) == numpy.core.memmap
def tearDown(self):
os.remove(os.path.join(
os.path.expanduser(theano.config.base_compiledir),
"_test.npy"))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论