提交 95e36534 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #1553 from nouiz/fix_tests

Fix tests
...@@ -12,6 +12,9 @@ from numpy.testing.noseclasses import KnownFailureTest ...@@ -12,6 +12,9 @@ from numpy.testing.noseclasses import KnownFailureTest
import theano.sandbox.gpuarray import theano.sandbox.gpuarray
if theano.sandbox.gpuarray.pygpu is None:
raise SkipTest("pygpu not installed")
import theano.sandbox.cuda as cuda_ndarray import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available and not theano.sandbox.gpuarray.pygpu_activated: if cuda_ndarray.cuda_available and not theano.sandbox.gpuarray.pygpu_activated:
if not cuda_ndarray.use.device_number: if not cuda_ndarray.use.device_number:
......
...@@ -1910,7 +1910,8 @@ class TestAlloc(unittest.TestCase): ...@@ -1910,7 +1910,8 @@ class TestAlloc(unittest.TestCase):
for (typ, shp) in [(vector, [3]), (matrix, [3,4])]: for (typ, shp) in [(vector, [3]), (matrix, [3,4])]:
x = typ() x = typ()
ones_tensor = theano.function([x], [tensor.ones(x.shape)]) ones_tensor = theano.function([x], [tensor.ones(x.shape)])
assert numpy.allclose(ones_tensor(numpy.zeros(shp)), inp = numpy.zeros(shp, dtype=config.floatX)
assert numpy.allclose(ones_tensor(inp),
numpy.ones(shp)) numpy.ones(shp))
def test_zeros(self): def test_zeros(self):
...@@ -1927,7 +1928,8 @@ class TestAlloc(unittest.TestCase): ...@@ -1927,7 +1928,8 @@ class TestAlloc(unittest.TestCase):
for (typ, shp) in [(vector, [3]), (matrix, [3,4])]: for (typ, shp) in [(vector, [3]), (matrix, [3,4])]:
x = typ() x = typ()
zeros_tensor = theano.function([x], [tensor.zeros(x.shape)]) zeros_tensor = theano.function([x], [tensor.zeros(x.shape)])
assert numpy.allclose(zeros_tensor(numpy.zeros(shp)), inp = numpy.zeros(shp, dtype=config.floatX)
assert numpy.allclose(zeros_tensor(inp),
numpy.zeros(shp)) numpy.zeros(shp))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论