提交 388628a9 authored 作者: Markus Roth's avatar Markus Roth

Revert "Refactor. Use decorators for skipping cuda-only-tests."

There is no more use for choosing single tests to skip. This reverts commit 99295012.
上级 3c349c5c
import unittest import unittest
import numpy import numpy
from numpy.testing.decorators import skipif from nose.plugins.skip import SkipTest
import theano import theano
from theano import tensor from theano import tensor
...@@ -8,10 +8,13 @@ from theano import tensor ...@@ -8,10 +8,13 @@ from theano import tensor
from theano.sandbox.cuda.var import float32_shared_constructor as f32sc from theano.sandbox.cuda.var import float32_shared_constructor as f32sc
from theano.sandbox.cuda import CudaNdarrayType, cuda_available from theano.sandbox.cuda import CudaNdarrayType, cuda_available
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
# Skip test if cuda_ndarray is not available.
if cuda_available == False:
raise SkipTest('Optional package cuda disabled')
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_float32_shared_constructor(): def test_float32_shared_constructor():
npy_row = numpy.zeros((1, 10), dtype='float32') npy_row = numpy.zeros((1, 10), dtype='float32')
def eq(a, b): def eq(a, b):
...@@ -37,7 +40,7 @@ def test_float32_shared_constructor(): ...@@ -37,7 +40,7 @@ def test_float32_shared_constructor():
f32sc(numpy.zeros((2, 3, 4, 5), dtype='float32')).type, f32sc(numpy.zeros((2, 3, 4, 5), dtype='float32')).type,
CudaNdarrayType((False,) * 4)) CudaNdarrayType((False,) * 4))
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_givens(): def test_givens():
# Test that you can use a TensorType expression to replace a # Test that you can use a TensorType expression to replace a
# CudaNdarrayType in the givens dictionary. # CudaNdarrayType in the givens dictionary.
...@@ -53,7 +56,6 @@ class T_updates(unittest.TestCase): ...@@ -53,7 +56,6 @@ class T_updates(unittest.TestCase):
# Test that you can use a TensorType expression to update a # Test that you can use a TensorType expression to update a
# CudaNdarrayType in the updates dictionary. # CudaNdarrayType in the updates dictionary.
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_1(self): def test_1(self):
data = numpy.float32([1, 2, 3, 4]) data = numpy.float32([1, 2, 3, 4])
x = f32sc(data) x = f32sc(data)
...@@ -65,7 +67,6 @@ class T_updates(unittest.TestCase): ...@@ -65,7 +67,6 @@ class T_updates(unittest.TestCase):
f = theano.function([], y, updates=[(x, cuda.gpu_from_host(x + 1))]) f = theano.function([], y, updates=[(x, cuda.gpu_from_host(x + 1))])
f() f()
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_2(self): def test_2(self):
# This test case uses code mentionned in #698 # This test case uses code mentionned in #698
data = numpy.random.rand(10, 10).astype('float32') data = numpy.random.rand(10, 10).astype('float32')
...@@ -79,7 +80,6 @@ class T_updates(unittest.TestCase): ...@@ -79,7 +80,6 @@ class T_updates(unittest.TestCase):
updates=output_updates, givens=output_givens) updates=output_updates, givens=output_givens)
output_func() output_func()
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_err_ndim(self): def test_err_ndim(self):
# Test that we raise a good error message when we don't # Test that we raise a good error message when we don't
# have the same number of dimensions. # have the same number of dimensions.
...@@ -92,7 +92,6 @@ class T_updates(unittest.TestCase): ...@@ -92,7 +92,6 @@ class T_updates(unittest.TestCase):
updates=[(output_var, updates=[(output_var,
output_var.sum())]) output_var.sum())])
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_err_broadcast(self): def test_err_broadcast(self):
# Test that we raise a good error message when we don't # Test that we raise a good error message when we don't
# have the same number of dimensions. # have the same number of dimensions.
...@@ -105,7 +104,6 @@ class T_updates(unittest.TestCase): ...@@ -105,7 +104,6 @@ class T_updates(unittest.TestCase):
updates=[(output_var, updates=[(output_var,
output_var.sum().dimshuffle('x', 'x'))]) output_var.sum().dimshuffle('x', 'x'))])
@skipif(not cuda_available, msg='Optional package cuda disabled')
def test_broadcast(self): def test_broadcast(self):
# Test that we can rebroadcast # Test that we can rebroadcast
data = numpy.random.rand(10, 10).astype('float32') data = numpy.random.rand(10, 10).astype('float32')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论