changeset 1468:cac29ca79a74

small fix to sgd. This should remove buildbot error.
author Frederic Bastien <nouiz@nouiz.org>
date Wed, 27 Apr 2011 10:43:04 -0400
parents b24ed2aa077e
children c41fdf8c35b8
files pylearn/gd/sgd.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/gd/sgd.py	Wed Apr 20 16:55:18 2011 -0400
+++ b/pylearn/gd/sgd.py	Wed Apr 27 10:43:04 2011 -0400
@@ -79,7 +79,8 @@
             raise TypeError('stepsize must be a scalar', stepsize)
 
         self.params = params
-        self.gparams = theano.tensor.grad(cost, self.params) if gradients is None else gradients
+        self.gparams = [theano.tensor.grad(cost, self.params)] if gradients is None else gradients
+        assert len(self.params) == len(self.gparams)
 
         self._updates = (dict((p, p - self.stepsize * g) for p, g in zip(self.params, self.gparams)))
         if updates is not None: