Mercurial > pylearn
changeset 1495:625fe86e3d5e
Merged
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Wed, 17 Aug 2011 10:18:59 -0400 |
parents | 0e6ca7eecc72 (diff) b1af99fd7bf6 (current diff) |
children | 93b8373c6735 |
files | |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/gd/sgd.py Tue Aug 16 15:44:15 2011 -0400 +++ b/pylearn/gd/sgd.py Wed Aug 17 10:18:59 2011 -0400 @@ -79,7 +79,10 @@ 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 + if gradients is None: + self.gparams = [theano.tensor.grad(cost, self.params)] + else: + self.gparams = 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)))