提交 df5d07f0 authored 作者: Frederic's avatar Frederic

make test pass when no c++ compiler under theano/{sandbox,scan_module}

上级 aa4ac20e
from nose.plugins.skip import SkipTest
import numpy import numpy
import theano import theano
...@@ -14,6 +15,8 @@ if theano.config.mode == 'FAST_COMPILE': ...@@ -14,6 +15,8 @@ if theano.config.mode == 'FAST_COMPILE':
else: else:
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu') mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
class T_Images2Neibs(unittest_tools.InferShapeTester): class T_Images2Neibs(unittest_tools.InferShapeTester):
def __init__(self, name): def __init__(self, name):
......
...@@ -6,6 +6,7 @@ import unittest ...@@ -6,6 +6,7 @@ import unittest
import cPickle import cPickle
import numpy import numpy
from nose.plugins.skip import SkipTest
from numpy.testing import dec from numpy.testing import dec
import theano import theano
...@@ -360,7 +361,6 @@ class T_Scan(unittest.TestCase): ...@@ -360,7 +361,6 @@ class T_Scan(unittest.TestCase):
# as test_one_sequence_one_output_weights, but on the gpu # as test_one_sequence_one_output_weights, but on the gpu
# This first version test the first case in the optimizer to the gpu. # This first version test the first case in the optimizer to the gpu.
def test_one_sequence_one_output_weights_gpu1(self): def test_one_sequence_one_output_weights_gpu1(self):
from nose.plugins.skip import SkipTest
from theano.sandbox import cuda from theano.sandbox import cuda
if cuda.cuda_available == False: if cuda.cuda_available == False:
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
...@@ -442,7 +442,6 @@ class T_Scan(unittest.TestCase): ...@@ -442,7 +442,6 @@ class T_Scan(unittest.TestCase):
# This second version test the second case in the optimizer to the gpu. # This second version test the second case in the optimizer to the gpu.
def test_one_sequence_one_output_weights_gpu2(self): def test_one_sequence_one_output_weights_gpu2(self):
from nose.plugins.skip import SkipTest
from theano.sandbox import cuda from theano.sandbox import cuda
if cuda.cuda_available == False: if cuda.cuda_available == False:
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
...@@ -1114,8 +1113,6 @@ class T_Scan(unittest.TestCase): ...@@ -1114,8 +1113,6 @@ class T_Scan(unittest.TestCase):
assert numpy.allclose(theano_v, numpy_v[5:, :]) assert numpy.allclose(theano_v, numpy_v[5:, :])
def test_cuda_gibbs_chain(self): def test_cuda_gibbs_chain(self):
import theano
from nose.plugins.skip import SkipTest
from theano.sandbox import cuda from theano.sandbox import cuda
if cuda.cuda_available == False: if cuda.cuda_available == False:
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
...@@ -3142,6 +3139,9 @@ def test_speed(): ...@@ -3142,6 +3139,9 @@ def test_speed():
# The computation being tested here is a recurrent addition. # The computation being tested here is a recurrent addition.
# #
# #
#We need the CVM for this speed test
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
r = numpy.arange(10000).astype(theano.config.floatX).reshape(1000, 10) r = numpy.arange(10000).astype(theano.config.floatX).reshape(1000, 10)
...@@ -3219,6 +3219,10 @@ def test_speed_rnn(): ...@@ -3219,6 +3219,10 @@ def test_speed_rnn():
# #
import theano.scalar.sharedvar import theano.scalar.sharedvar
#We need the CVM for this speed test
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
L = 10000 L = 10000
N = 50 N = 50
...@@ -3295,6 +3299,9 @@ def test_speed_batchrnn(): ...@@ -3295,6 +3299,9 @@ def test_speed_batchrnn():
# #
import theano.scalar.sharedvar import theano.scalar.sharedvar
#We need the CVM for this speed test
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
L = 100 L = 100
B = 50 B = 50
N = 400 N = 400
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论