# HG changeset patch # User Frederic Bastien # Date 1270137189 14400 # Node ID ffaf94da810031f5f37f3ba3099d573039510df1 # Parent 995b50f0c2ee248e315d7c2212e78ba495d49b35 make test faster in debug mode. diff -r 995b50f0c2ee -r ffaf94da8100 pylearn/shared/layers/tests/test_kouh2008.py --- a/pylearn/shared/layers/tests/test_kouh2008.py Wed Mar 31 15:18:09 2010 -0400 +++ b/pylearn/shared/layers/tests/test_kouh2008.py Thu Apr 01 11:53:09 2010 -0400 @@ -1,5 +1,6 @@ import numpy import theano.compile.debugmode +from theano.compile.debugmode import DebugMode from theano import tensor from theano.compile import pfunc from pylearn.shared.layers import LogisticRegression, Kouh2008 @@ -15,6 +16,9 @@ assert layer.output.dtype =='float32' def run_w_random(bsize=10, n_iter=200, n_in = 1024, n_out = 100, n_terms=2, dtype='float64'): + if isinstance(theano.compile.mode.get_default_mode(),DebugMode): + n_iter=2 + x = tensor.dmatrix() y = tensor.lvector() rng = numpy.random.RandomState(23455) @@ -97,11 +101,16 @@ test_A() def test_smaller(): - assert run_w_random(n_in=10, n_out=8) < 6.1 + rval = run_w_random(n_in=10, n_out=8) + if not isinstance(theano.compile.mode.get_default_mode(),DebugMode): + assert rval < 6.1 def test_smaller32(): - assert run_w_random(n_in=10, n_out=8, dtype='float32') < 6.1 + rval = run_w_random(n_in=10, n_out=8, dtype='float32') + if not isinstance(theano.compile.mode.get_default_mode(),DebugMode): + assert rval < 6.1 def test_big(): - assert run_w_random() < 0.1 - + rval = run_w_random() + if not isinstance(theano.compile.mode.get_default_mode(),DebugMode): + assert rval < 0.1