changeset 1506:2f69c9932d9a

Fix test in float32.
author Frederic Bastien <nouiz@nouiz.org>
date Mon, 12 Sep 2011 10:56:38 -0400
parents 723e2d761985
children 2a6a6f16416c
files pylearn/algorithms/regressor.py pylearn/algorithms/tests/test_regressor.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/regressor.py	Mon Sep 12 10:49:15 2011 -0400
+++ b/pylearn/algorithms/regressor.py	Mon Sep 12 10:56:38 2011 -0400
@@ -16,12 +16,12 @@
         if input:
           self.input = input
         else:
-          self.input = T.dmatrix('input')
+          self.input = T.matrix('input')
 
         if target:
           self.target = target
         else:
-          self.target = T.dmatrix('target')
+          self.target = T.matrix('target')
         #backport
         #self.input = input if input else T.matrix('input')
         #self.target = target if target else T.matrix('target')
@@ -71,8 +71,8 @@
         if input_size is not None:
             sz = (input_size, output_size)
             range = 1/N.sqrt(input_size)
-            obj.w = R.uniform(size = sz, low = -range, high = range)
-            obj.b = N.zeros(output_size)
+            obj.w = R.uniform(size = sz, low = -range, high = range).astype(theano.config.floatX)
+            obj.b = N.zeros(output_size, dtype = theano.config.floatX)
         obj.__hide__ = ['params']
 
     def _instance_flops_approx(self, obj):
--- a/pylearn/algorithms/tests/test_regressor.py	Mon Sep 12 10:49:15 2011 -0400
+++ b/pylearn/algorithms/tests/test_regressor.py	Mon Sep 12 10:56:38 2011 -0400
@@ -21,7 +21,7 @@
     R = numpy.random.RandomState(100)
     t1 = time.time()
     for i in xrange(1001):
-        data = R.random_integers(0, 1, size = (10, 100))
+        data = R.random_integers(0, 1, size = (10, 100)).astype(theano.config.floatX)
         targets = data[:, 6].reshape((10, 1))
         cost = model.update(data, targets)
         if i % 100 == 0: