提交 027566e1 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1723 from abergeron/tag_slow

Tag slow tests
...@@ -885,9 +885,9 @@ if 0: # old code still to be ported from ProfileMode ...@@ -885,9 +885,9 @@ if 0: # old code still to be ported from ProfileMode
print 'Theano fct call %.3fs %.1f%%' % (total_fct_time, print 'Theano fct call %.3fs %.1f%%' % (total_fct_time,
total_fct_time / total_time * total_fct_time / total_time *
100) 100)
print ' Theano Op time (included in fct call, Time spent running thunks) %.3fs %.1f%%(of total) %.1f%%(of fct call)' % (local_time, print (' Theano Op time (included in fct call, Time spent '
local_time / total_time * 100, 'running thunks) %.3fs %.1f%%(of total) %.1f%%(of fct call)' %
time_pr_in_fct) (local_time, local_time / total_time * 100, time_pr_in_fct))
print 'Other time since import %.3fs %.1f%%'%(other_time,other_time/total_time*100) print 'Other time since import %.3fs %.1f%%'%(other_time,other_time/total_time*100)
print '%i Theano fct call, %.3fs per call'%(total_fct_call, time_per_call) print '%i Theano fct call, %.3fs per call'%(total_fct_call, time_per_call)
......
...@@ -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,7 @@ def test_cholesky_grad(): ...@@ -93,6 +94,7 @@ def test_cholesky_grad():
rng, eps=eps)) rng, eps=eps))
@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 +397,7 @@ class test_diag(unittest.TestCase): ...@@ -395,6 +397,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)
......
...@@ -16,6 +16,7 @@ if cuda_available: ...@@ -16,6 +16,7 @@ if cuda_available:
import unittest import unittest
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
#TODO: test gpu #TODO: test gpu
# Done in test_consistency_GPU_{serial,parallel} # Done in test_consistency_GPU_{serial,parallel}
...@@ -445,6 +446,7 @@ def test_uniform(): ...@@ -445,6 +446,7 @@ def test_uniform():
allow_01=True, inputs=input) allow_01=True, inputs=input)
@attr('slow')
def test_binomial(): def test_binomial():
#TODO: test size=None, ndim=X #TODO: test size=None, ndim=X
#TODO: test size=X, ndim!=X.ndim #TODO: test size=X, ndim!=X.ndim
...@@ -532,6 +534,7 @@ def test_binomial(): ...@@ -532,6 +534,7 @@ def test_binomial():
inputs=input, target_avg=mean, mean_rtol=rtol) inputs=input, target_avg=mean, mean_rtol=rtol)
@attr('slow')
def test_normal0(): def test_normal0():
steps = 50 steps = 50
......
...@@ -8,6 +8,7 @@ import unittest ...@@ -8,6 +8,7 @@ import unittest
import cPickle import cPickle
import numpy import numpy
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
from numpy.testing import dec from numpy.testing import dec
import theano import theano
...@@ -1525,6 +1526,7 @@ class T_Scan(unittest.TestCase): ...@@ -1525,6 +1526,7 @@ class T_Scan(unittest.TestCase):
analytic_grad[max_err_pos], analytic_grad[max_err_pos],
num_grad.gx[max_err_pos])) num_grad.gx[max_err_pos]))
@attr('slow')
def test_grad_multiple_outs_taps(self): def test_grad_multiple_outs_taps(self):
l = 5 l = 5
rng = numpy.random.RandomState(utt.fetch_seed()) rng = numpy.random.RandomState(utt.fetch_seed())
...@@ -1618,6 +1620,7 @@ class T_Scan(unittest.TestCase): ...@@ -1618,6 +1620,7 @@ class T_Scan(unittest.TestCase):
analytic_grad[max_err_pos], analytic_grad[max_err_pos],
num_grad.gx[max_err_pos])) num_grad.gx[max_err_pos]))
@attr('slow')
def test_grad_multiple_outs_taps_backwards(self): def test_grad_multiple_outs_taps_backwards(self):
l = 5 l = 5
rng = numpy.random.RandomState(utt.fetch_seed()) rng = numpy.random.RandomState(utt.fetch_seed())
...@@ -2599,6 +2602,7 @@ class T_Scan(unittest.TestCase): ...@@ -2599,6 +2602,7 @@ class T_Scan(unittest.TestCase):
f2 = theano.function([], gx) f2 = theano.function([], gx)
utt.assert_allclose(f2(), numpy.ones((10,))) utt.assert_allclose(f2(), numpy.ones((10,)))
@attr('slow')
def test_rop2(self): def test_rop2(self):
seed = utt.fetch_seed() seed = utt.fetch_seed()
rng = numpy.random.RandomState(seed) rng = numpy.random.RandomState(seed)
...@@ -3659,6 +3663,7 @@ class T_Scan(unittest.TestCase): ...@@ -3659,6 +3663,7 @@ class T_Scan(unittest.TestCase):
inp = scan_node.op.outer_non_seqs(scan_node) inp = scan_node.op.outer_non_seqs(scan_node)
assert len(inp) == 1 assert len(inp) == 1
@attr('slow')
def test_hessian_bug_grad_grad_two_scans(self): def test_hessian_bug_grad_grad_two_scans(self):
#Bug reported by Bitton Tenessi #Bug reported by Bitton Tenessi
......
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
import sys import sys
import time import time
import unittest import unittest
...@@ -128,6 +129,7 @@ class TestSP(unittest.TestCase): ...@@ -128,6 +129,7 @@ class TestSP(unittest.TestCase):
#profmode.print_summary() #profmode.print_summary()
@attr('slow')
def test_sparse(self): def test_sparse(self):
# print '\n\n*************************************************' # print '\n\n*************************************************'
......
...@@ -1226,6 +1226,7 @@ class UsmmTests(unittest.TestCase): ...@@ -1226,6 +1226,7 @@ class UsmmTests(unittest.TestCase):
self.z = numpy.asarray(self.rng.uniform(-1, 1, z_size), self.z = numpy.asarray(self.rng.uniform(-1, 1, z_size),
dtype=theano.config.floatX) dtype=theano.config.floatX)
# this is slow, but it's the only test for the op.
def test(self): def test(self):
def mat(format, name, dtype): def mat(format, name, dtype):
if format == 'dense': if format == 'dense':
...@@ -2069,6 +2070,7 @@ class CastTester(utt.InferShapeTester): ...@@ -2069,6 +2070,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:
......
import time import time
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
import numpy import numpy
import theano import theano
...@@ -246,6 +247,7 @@ class TestConv2D(utt.InferShapeTester): ...@@ -246,6 +247,7 @@ class TestConv2D(utt.InferShapeTester):
N_image_shape=(2, 3, 3, 3), N_filter_shape=(5, 3, 2, 2), N_image_shape=(2, 3, 3, 3), N_filter_shape=(5, 3, 2, 2),
should_raise=True) should_raise=True)
@attr('slow')
def test_subsample(self): def test_subsample(self):
""" """
Tests convolution where subsampling != (1,1) Tests convolution where subsampling != (1,1)
...@@ -282,6 +284,7 @@ class TestConv2D(utt.InferShapeTester): ...@@ -282,6 +284,7 @@ class TestConv2D(utt.InferShapeTester):
(3, 2, 8, 8), (4, 3, 5, 5), (3, 2, 8, 8), (4, 3, 5, 5),
'valid') 'valid')
@attr('slow')
def test_invalid_input_shape(self): def test_invalid_input_shape(self):
""" """
Tests that when the shape gived at build time is not the same as Tests that when the shape gived at build time is not the same as
......
...@@ -12,6 +12,7 @@ import theano.sparse ...@@ -12,6 +12,7 @@ import theano.sparse
if theano.sparse.enable_sparse: if theano.sparse.enable_sparse:
from scipy import sparse from scipy import sparse
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
floatX = theano.config.floatX floatX = theano.config.floatX
...@@ -222,6 +223,7 @@ class TestConv3D(utt.InferShapeTester): ...@@ -222,6 +223,7 @@ class TestConv3D(utt.InferShapeTester):
self.randomize() self.randomize()
self.check_c_against_python(self.V.get_value(borrow=True).shape[1:4]) self.check_c_against_python(self.V.get_value(borrow=True).shape[1:4])
@attr('slow')
def test_c_against_mat_mul(self): def test_c_against_mat_mul(self):
# Use a filter of the same size as the image, so the convolution is # Use a filter of the same size as the image, so the convolution is
# just a dense matrix multiply. # just a dense matrix multiply.
......
...@@ -13,6 +13,7 @@ import __builtin__ ...@@ -13,6 +13,7 @@ import __builtin__
builtin_min = __builtin__.min builtin_min = __builtin__.min
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
import numpy import numpy
from numpy.testing import dec, assert_array_equal, assert_allclose from numpy.testing import dec, assert_array_equal, assert_allclose
from numpy.testing.noseclasses import KnownFailureTest from numpy.testing.noseclasses import KnownFailureTest
...@@ -1996,6 +1997,7 @@ class TestAlloc(unittest.TestCase): ...@@ -1996,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.
...@@ -4050,6 +4052,7 @@ class t_dot(unittest.TestCase): ...@@ -4050,6 +4052,7 @@ class t_dot(unittest.TestCase):
utt.verify_grad(dot, [rand(2, 3, 4), rand(4, 5)]) utt.verify_grad(dot, [rand(2, 3, 4), rand(4, 5)])
utt.verify_grad(dot, [rand(2, 3, 4), rand(3, 4, 5)]) utt.verify_grad(dot, [rand(2, 3, 4), rand(3, 4, 5)])
@attr('slow')
def test_broadcastable_patterns(self): def test_broadcastable_patterns(self):
# #
......
...@@ -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
...@@ -855,6 +857,7 @@ def test_dot22(): ...@@ -855,6 +857,7 @@ def test_dot22():
cmp((0, 0), (0, 0)) cmp((0, 0), (0, 0))
@attr('slow')
def test_dot22scalar(): def test_dot22scalar():
## including does not seem to work for 'local_dot_to_dot22' and ## including does not seem to work for 'local_dot_to_dot22' and
## 'local_dot22_to_dot22scalar' ## 'local_dot22_to_dot22scalar'
...@@ -1179,6 +1182,7 @@ class TestGemv(TestCase, unittest_tools.TestOptimizationMixin): ...@@ -1179,6 +1182,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))
......
...@@ -5,6 +5,7 @@ import unittest ...@@ -5,6 +5,7 @@ import unittest
import numpy import numpy
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.python25 import all, any from theano.gof.python25 import all, any
...@@ -470,6 +471,7 @@ class test_CAReduce(unittest_tools.InferShapeTester): ...@@ -470,6 +471,7 @@ class test_CAReduce(unittest_tools.InferShapeTester):
self.with_linker(gof.PerformLinker(), scalar.and_, dtype=dtype, self.with_linker(gof.PerformLinker(), scalar.and_, dtype=dtype,
test_nan=True, tensor_op=tensor.all) test_nan=True, tensor_op=tensor.all)
@attr('slow')
def test_c(self): def test_c(self):
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.")
...@@ -629,6 +631,7 @@ class test_Prod(unittest.TestCase): ...@@ -629,6 +631,7 @@ class test_Prod(unittest.TestCase):
fn_a0 = theano.function([x], pwz_a0, mode=self.mode) fn_a0 = theano.function([x], pwz_a0, mode=self.mode)
assert numpy.allclose(fn_a0(x_val), [1, 10, 162]) assert numpy.allclose(fn_a0(x_val), [1, 10, 162])
@attr('slow')
def test_other_grad_tests(self): def test_other_grad_tests(self):
x = theano.tensor.dmatrix() x = theano.tensor.dmatrix()
x_val1 = numpy.array([[1, 2, 3], [0, 5, 6], [0, 0, 9]], x_val1 = numpy.array([[1, 2, 3], [0, 5, 6], [0, 0, 9]],
...@@ -760,6 +763,7 @@ class T_sum_dtype(unittest.TestCase): ...@@ -760,6 +763,7 @@ class T_sum_dtype(unittest.TestCase):
data = data.astype(dtype) data = data.astype(dtype)
f(data) f(data)
@attr('slow')
def test_sum_custom_dtype(self): def test_sum_custom_dtype(self):
""" """
Test the ability to provide your own output dtype for a sum. Test the ability to provide your own output dtype for a sum.
...@@ -860,6 +864,7 @@ class T_mean_dtype(unittest.TestCase): ...@@ -860,6 +864,7 @@ class T_mean_dtype(unittest.TestCase):
data = data.astype(dtype) data = data.astype(dtype)
f(data) f(data)
@attr('slow')
def test_mean_custom_dtype(self): def test_mean_custom_dtype(self):
""" """
Test the ability to provide your own output dtype for a mean. Test the ability to provide your own output dtype for a mean.
...@@ -967,6 +972,7 @@ class T_prod_dtype(unittest.TestCase): ...@@ -967,6 +972,7 @@ class T_prod_dtype(unittest.TestCase):
data = data.astype(dtype) data = data.astype(dtype)
f(data) f(data)
@attr('slow')
def test_prod_custom_dtype(self): def test_prod_custom_dtype(self):
""" """
Test the ability to provide your own output dtype for a prod. Test the ability to provide your own output dtype for a prod.
...@@ -998,6 +1004,7 @@ class T_prod_dtype(unittest.TestCase): ...@@ -998,6 +1004,7 @@ class T_prod_dtype(unittest.TestCase):
tensor.grad(prod_var.sum(), x, tensor.grad(prod_var.sum(), x,
disconnected_inputs='ignore') disconnected_inputs='ignore')
@attr('slow')
def test_prod_custom_acc_dtype(self): def test_prod_custom_acc_dtype(self):
""" """
Test the ability to provide your own acc_dtype for a prod. Test the ability to provide your own acc_dtype for a prod.
...@@ -1086,6 +1093,7 @@ class T_prod_without_zeros_dtype(unittest.TestCase): ...@@ -1086,6 +1093,7 @@ class T_prod_without_zeros_dtype(unittest.TestCase):
data = data.astype(dtype) data = data.astype(dtype)
f(data) f(data)
@attr('slow')
def test_prod_without_zeros_custom_dtype(self): def test_prod_without_zeros_custom_dtype(self):
""" """
Test ability to provide your own output dtype for a ProdWithoutZeros(). Test ability to provide your own output dtype for a ProdWithoutZeros().
...@@ -1109,6 +1117,7 @@ class T_prod_without_zeros_dtype(unittest.TestCase): ...@@ -1109,6 +1117,7 @@ class T_prod_without_zeros_dtype(unittest.TestCase):
data = data.astype(input_dtype) data = data.astype(input_dtype)
f(data) f(data)
@attr('slow')
def test_prod_without_zeros_custom_acc_dtype(self): def test_prod_without_zeros_custom_acc_dtype(self):
""" """
Test ability to provide your own acc_dtype for a ProdWithoutZeros(). Test ability to provide your own acc_dtype for a ProdWithoutZeros().
......
...@@ -407,13 +407,6 @@ class TestBartlett(utt.InferShapeTester): ...@@ -407,13 +407,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)
...@@ -470,11 +463,3 @@ class TestFillDiagonal(utt.InferShapeTester): ...@@ -470,11 +463,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()
from nose.plugins.attrib import attr
import numpy import numpy
from theano import tensor, function from theano import tensor, function
import unittest
class TestKeepDims: # this tests other ops to ensure they keep the dimensions of their
# inputs correctly
class TestKeepDims(unittest.TestCase):
def makeKeepDims_local(self, x, y, axis): def makeKeepDims_local(self, x, y, axis):
x = tensor.as_tensor_variable(x) x = tensor.as_tensor_variable(x)
...@@ -28,6 +33,7 @@ class TestKeepDims: ...@@ -28,6 +33,7 @@ class TestKeepDims:
return tensor.DimShuffle(y.type.broadcastable, new_dims)(y) return tensor.DimShuffle(y.type.broadcastable, new_dims)(y)
@attr('slow')
def test_keepdims(self): def test_keepdims(self):
x = tensor.dtensor3() x = tensor.dtensor3()
...@@ -95,7 +101,3 @@ class TestKeepDims: ...@@ -95,7 +101,3 @@ class TestKeepDims:
assert numpy.allclose(keep_param(a), keep_synth(a)) assert numpy.allclose(keep_param(a), keep_synth(a))
assert keep_param(a).shape == keep_synth(a).shape assert keep_param(a).shape == keep_synth(a).shape
if __name__ == '__main__':
TestKeepDims().test_keepdims()
...@@ -12,6 +12,8 @@ import sys ...@@ -12,6 +12,8 @@ import sys
from theano.tests import unittest_tools from theano.tests import unittest_tools
from numpy.testing.noseclasses import KnownFailureTest from numpy.testing.noseclasses import KnownFailureTest
from nose.plugins.attrib import attr
def cross_entropy(target, output, axis=1): def cross_entropy(target, output, axis=1):
""" """
...@@ -557,6 +559,7 @@ def create_realistic(window_size=3, # 7, ...@@ -557,6 +559,7 @@ def create_realistic(window_size=3, # 7,
return model return model
@attr('slow')
def test_naacl_model(iters_per_unsup=3, iters_per_sup=3, def test_naacl_model(iters_per_unsup=3, iters_per_sup=3,
optimizer=None, realistic=False): optimizer=None, realistic=False):
#print "BUILDING MODEL" #print "BUILDING MODEL"
...@@ -643,13 +646,7 @@ def jtest_main(): ...@@ -643,13 +646,7 @@ def jtest_main():
test_naacl_model(optimizer, 10, 10, realistic=False) test_naacl_model(optimizer, 10, 10, realistic=False)
def real_main():
test_naacl_model()
def profile_main(): def profile_main():
# This is the main function for profiling
# We've renamed our original main() above to real_main()
import cProfile import cProfile
import pstats import pstats
from theano.compat.six import StringIO from theano.compat.six import StringIO
...@@ -664,5 +661,4 @@ def profile_main(): ...@@ -664,5 +661,4 @@ def profile_main():
# stats.print_callers() # stats.print_callers()
if __name__ == '__main__': if __name__ == '__main__':
#real_main()
profile_main() profile_main()
...@@ -4,6 +4,7 @@ import sys ...@@ -4,6 +4,7 @@ import sys
import unittest import unittest
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr
import numpy import numpy
import theano import theano
...@@ -499,6 +500,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -499,6 +500,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
self.assertTrue(isinstance(topo_[0].op, self.adv_sub1)) self.assertTrue(isinstance(topo_[0].op, self.adv_sub1))
self.assertTrue(numpy.allclose(f([0]), ones[0] * 5)) self.assertTrue(numpy.allclose(f([0]), ones[0] * 5))
@attr('slow')
def test_shape_i_const(self): def test_shape_i_const(self):
# Each axis is treated independently by shape_i/shape operators # Each axis is treated independently by shape_i/shape operators
...@@ -756,6 +758,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -756,6 +758,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
except TypeError: except TypeError:
pass pass
@attr('slow')
def test_grad_list(self): def test_grad_list(self):
data = rand(4) data = rand(4)
data = numpy.asarray(data, dtype=self.dtype) data = numpy.asarray(data, dtype=self.dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论