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