# HG changeset patch # User Frederic Bastien # Date 1247242580 14400 # Node ID d98117100166dad72bc00608dc29cce535c0e10d # Parent 7a65c5b79acabef453abb82d0a4072403f36956f fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value. diff -r 7a65c5b79aca -r d98117100166 pylearn/sandbox/test_scan_inputs_groups.py --- a/pylearn/sandbox/test_scan_inputs_groups.py Fri Jul 10 11:31:32 2009 -0400 +++ b/pylearn/sandbox/test_scan_inputs_groups.py Fri Jul 10 12:16:20 2009 -0400 @@ -1,4 +1,4 @@ -import sys, time, unittest +import sys, time, unittest, copy import numpy,time import numpy as N @@ -8,18 +8,27 @@ from theano import function, Mode import theano.tensor as T from pylearn.sandbox.scan_inputs_groups import FillMissing +import theano.compile.mode as mode_module class TestFillMissing(unittest.TestCase): def setUp(self): utt.seed_rng() + #we need to desactivate the check for NaN value as we have them in input + #TODO: Make an option to don't check NaN value in input only, bug check in output. + m=mode_module.default_mode + if m=="DEBUG_MODE": + m=copy.copy(mode_module.predefined_modes[m]) + m.check_isfinite=False + self.mode = m + def test_vector(self): print "test_vector" n=100000 v=T.dvector() def t(prob,val,fill): op=FillMissing(fill)(v) - f=function([v],op) + f=function([v],op,mode=self.mode) nb_missing=0 for i in range(n): if prob[i]<0.1: @@ -54,7 +63,7 @@ v=T.dmatrix() def t(prob,val,fill): op=FillMissing(fill)(v) - f=function([v],op) + f=function([v],op,mode=self.mode) nb_missing=0 for i in range(shp[0]): @@ -92,7 +101,7 @@ shp=(10,100,100) v= T.TensorType('float64', (False, False, False))() op=FillMissing()(v) - fct=function([v],op) + fct=function([v],op,mode=self.mode) prob=N.random.random(N.prod(shp)).reshape(shp) val=N.random.random(prob.shape)