Mercurial > pylearn
changeset 927:ffaf94da8100
make test faster in debug mode.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Thu, 01 Apr 2010 11:53:09 -0400 |
parents | 995b50f0c2ee |
children | 87d416e1f4fd |
files | pylearn/shared/layers/tests/test_kouh2008.py |
diffstat | 1 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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