changeset 1528:dee276045768

make test don't run in debug mode as it is too slow.
author Frederic Bastien <nouiz@nouiz.org>
date Fri, 09 Nov 2012 17:06:30 -0500
parents 211b217f9691
children 9737834dcb0f
files pylearn/sampling/tests/test_hmc.py
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/tests/test_hmc.py	Fri Nov 09 16:58:37 2012 -0500
+++ b/pylearn/sampling/tests/test_hmc.py	Fri Nov 09 17:06:30 2012 -0500
@@ -62,8 +62,18 @@
 
 def test_hmc():
     print ('HMC')
-    sampler = _sampler_on_2d_gaussian(HMC_sampler.new_from_shared_positions,
-                                      burnin=3000 / 20, n_samples=90000 / 20)
-    assert abs(sampler.avg_acceptance_rate.get_value() - sampler.target_acceptance_rate) < .1
+    try:
+        orig_mode = theano.config.mode
+        if theano.config.mode in ["DebugMode", "DEBUG_MODE"]:
+            theano.config.mode = "FAST_RUN"
+            sampler = _sampler_on_2d_gaussian(
+                HMC_sampler.new_from_shared_positions,
+                burnin=3000 / 20, n_samples=90000 / 20)
+    finally:
+        theano.config.mode = orig_mode
+
+
+    assert abs(sampler.avg_acceptance_rate.get_value() -
+               sampler.target_acceptance_rate) < .1
     assert sampler.stepsize.get_value() >= sampler.stepsize_min
     assert sampler.stepsize.get_value() <= sampler.stepsize_max