提交 10efa2bf authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Mark some more tests as slow and do some cleanup while there.

上级 151ec94b
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import unittest import unittest
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
import theano import theano
from theano.gof.link import PerformLinker from theano.gof.link import PerformLinker
...@@ -191,6 +192,7 @@ def test_clinker_straightforward(): ...@@ -191,6 +192,7 @@ def test_clinker_straightforward():
assert fn(2.0, 2.0, 2.0) == 2.0 assert fn(2.0, 2.0, 2.0) == 2.0
@attr('slow')
def test_clinker_literal_inlining(): def test_clinker_literal_inlining():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
...@@ -206,6 +208,7 @@ def test_clinker_literal_inlining(): ...@@ -206,6 +208,7 @@ def test_clinker_literal_inlining():
assert "4.12345678" in code # we expect the number to be inlined assert "4.12345678" in code # we expect the number to be inlined
@attr('slow')
def test_clinker_single_node(): def test_clinker_single_node():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
...@@ -216,6 +219,7 @@ def test_clinker_single_node(): ...@@ -216,6 +219,7 @@ def test_clinker_single_node():
assert fn(2.0, 7.0) == 9 assert fn(2.0, 7.0) == 9
@attr('slow')
def test_clinker_dups(): def test_clinker_dups():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
...@@ -228,18 +232,19 @@ def test_clinker_dups(): ...@@ -228,18 +232,19 @@ def test_clinker_dups():
# note: for now the behavior of fn(2.0, 7.0) is undefined # note: for now the behavior of fn(2.0, 7.0) is undefined
@attr('slow')
def test_clinker_not_used_inputs(): def test_clinker_not_used_inputs():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
# Testing that duplicate inputs are allowed. # Testing that unused inputs are allowed.
x, y, z = inputs() x, y, z = inputs()
e = add(x, y) e = add(x, y)
lnk = CLinker().accept(Env([x, y, z], [e])) lnk = CLinker().accept(Env([x, y, z], [e]))
fn = lnk.make_function() fn = lnk.make_function()
assert fn(2.0, 1.5, 1.0) == 3.5 assert fn(2.0, 1.5, 1.0) == 3.5
# note: for now the behavior of fn(2.0, 7.0) is undefined
@attr('slow')
def test_clinker_dups_inner(): def test_clinker_dups_inner():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
...@@ -255,6 +260,7 @@ def test_clinker_dups_inner(): ...@@ -255,6 +260,7 @@ def test_clinker_dups_inner():
# Test OpWiseCLinker # # Test OpWiseCLinker #
###################### ######################
# slow on linux, but near sole test and very central
def test_opwiseclinker_straightforward(): def test_opwiseclinker_straightforward():
x, y, z = inputs() x, y, z = inputs()
e = add(mul(add(x, y), div(x, y)), bad_sub(bad_sub(x, y), z)) e = add(mul(add(x, y), div(x, y)), bad_sub(bad_sub(x, y), z))
...@@ -267,6 +273,7 @@ def test_opwiseclinker_straightforward(): ...@@ -267,6 +273,7 @@ def test_opwiseclinker_straightforward():
assert fn(2.0, 2.0, 2.0) == -6 assert fn(2.0, 2.0, 2.0) == -6
@attr('slow')
def test_opwiseclinker_constant(): def test_opwiseclinker_constant():
x, y, z = inputs() x, y, z = inputs()
x = Constant(tdouble, 7.2, name='x') x = Constant(tdouble, 7.2, name='x')
...@@ -300,6 +307,7 @@ def test_duallinker_straightforward(): ...@@ -300,6 +307,7 @@ def test_duallinker_straightforward():
assert res == 15.3 assert res == 15.3
@attr('slow')
def test_duallinker_mismatch(): def test_duallinker_mismatch():
if not theano.config.cxx: if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.") raise SkipTest("G++ not available, so we need to skip this test.")
......
...@@ -34,6 +34,7 @@ from theano.sandbox.linalg.ops import (cholesky, ...@@ -34,6 +34,7 @@ from theano.sandbox.linalg.ops import (cholesky,
) )
from theano.sandbox.linalg import eig, eigh from theano.sandbox.linalg import eig, eigh
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
def check_lower_triangular(pd, ch_f): def check_lower_triangular(pd, ch_f):
...@@ -93,6 +94,9 @@ def test_cholesky_grad(): ...@@ -93,6 +94,9 @@ def test_cholesky_grad():
rng, eps=eps)) rng, eps=eps))
# This is possibly redundant since we already have a test for the op
# and its grad above.
@attr('slow')
def test_cholesky_and_cholesky_grad_shape(): def test_cholesky_and_cholesky_grad_shape():
if not imported_scipy: if not imported_scipy:
raise SkipTest("Scipy needed for the Cholesky op.") raise SkipTest("Scipy needed for the Cholesky op.")
...@@ -395,6 +399,7 @@ class test_diag(unittest.TestCase): ...@@ -395,6 +399,7 @@ class test_diag(unittest.TestCase):
x = rng.rand(5, 4).astype(self.floatX) x = rng.rand(5, 4).astype(self.floatX)
tensor.verify_grad(extract_diag, [x], rng=rng) tensor.verify_grad(extract_diag, [x], rng=rng)
@attr('slow')
def test_extract_diag_empty(self): def test_extract_diag_empty(self):
c = self.shared(numpy.array([[], []], self.floatX)) c = self.shared(numpy.array([[], []], self.floatX))
f = theano.function([], extract_diag(c), mode=self.mode) f = theano.function([], extract_diag(c), mode=self.mode)
......
...@@ -2110,6 +2110,7 @@ class CastTester(utt.InferShapeTester): ...@@ -2110,6 +2110,7 @@ class CastTester(utt.InferShapeTester):
def setUp(self): def setUp(self):
super(CastTester, self).setUp() super(CastTester, self).setUp()
# slow but only test
def test_cast(self): def test_cast(self):
for format in sparse.sparse_formats: for format in sparse.sparse_formats:
for i_dtype in sparse.all_dtypes: for i_dtype in sparse.all_dtypes:
......
...@@ -1997,6 +1997,7 @@ class TestAlloc(unittest.TestCase): ...@@ -1997,6 +1997,7 @@ class TestAlloc(unittest.TestCase):
numpy.zeros(shp)) numpy.zeros(shp))
# This is slow for the ('int8', 3) version.
def test_eye(): def test_eye():
def check(dtype, N, M_=None, k=0): def check(dtype, N, M_=None, k=0):
# Theano does not accept None as a tensor. # Theano does not accept None as a tensor.
......
...@@ -6,6 +6,8 @@ from numpy import (arange, array, common_type, complex64, complex128, float32, ...@@ -6,6 +6,8 @@ from numpy import (arange, array, common_type, complex64, complex128, float32,
float64, newaxis, shape, transpose, zeros) float64, newaxis, shape, transpose, zeros)
from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_almost_equal
from nose.plugins.attrib import attr
import theano import theano
import theano.tensor as T import theano.tensor as T
from theano import tensor, Param, shared, config from theano import tensor, Param, shared, config
...@@ -1186,6 +1188,7 @@ class TestGemv(TestCase, unittest_tools.TestOptimizationMixin): ...@@ -1186,6 +1188,7 @@ class TestGemv(TestCase, unittest_tools.TestOptimizationMixin):
assert numpy.allclose(v2.get_value(), assert numpy.allclose(v2.get_value(),
numpy.dot(m.get_value(), v1.get_value()) + v2_orig) numpy.dot(m.get_value(), v1.get_value()) + v2_orig)
@attr('slow')
def test_gemv1(self): def test_gemv1(self):
self.t_gemv1((3, 2)) self.t_gemv1((3, 2))
self.t_gemv1((0, 2)) self.t_gemv1((0, 2))
......
...@@ -319,13 +319,6 @@ class TestBartlett(utt.InferShapeTester): ...@@ -319,13 +319,6 @@ class TestBartlett(utt.InferShapeTester):
self._compile_and_check([x], [self.op(x)], [1], self.op_class) self._compile_and_check([x], [self.op(x)], [1], self.op_class)
if __name__ == "__main__":
t = TestBartlett('setUp')
t.setUp()
t.test_perform()
t.test_infer_shape()
class TestFillDiagonal(utt.InferShapeTester): class TestFillDiagonal(utt.InferShapeTester):
rng = numpy.random.RandomState(43) rng = numpy.random.RandomState(43)
...@@ -382,11 +375,3 @@ class TestFillDiagonal(utt.InferShapeTester): ...@@ -382,11 +375,3 @@ class TestFillDiagonal(utt.InferShapeTester):
numpy.random.rand()], numpy.random.rand()],
self.op_class, self.op_class,
warn=False) warn=False)
if __name__ == "__main__":
utt.unittest.main()
t = TestFillDiagonal('setUp')
t.setUp()
t.test_perform()
t.test_gradient()
t.test_infer_shape()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论