Mercurial > pylearn
changeset 1472:ddda8d93c162
dtype tweaks in sgd
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Wed, 18 May 2011 10:51:50 -0400 |
parents | 281efa9a4463 |
children | 91a475ca9b6d |
files | pylearn/gd/sgd.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/gd/sgd.py Wed May 18 10:51:11 2011 -0400 +++ b/pylearn/gd/sgd.py Wed May 18 10:51:50 2011 -0400 @@ -1,6 +1,6 @@ """A stochastic gradient descent minimizer. """ - +import numpy import theano def sgd_updates(params, grads, stepsizes): @@ -35,11 +35,11 @@ momentum = [momentum for p in params] if len(params) != len(grads): raise ValueError('params and grads have different lens') - headings = [theano.shared(p.get_value(borrow=False)*0) for p in params] + headings = [theano.shared(numpy.zeros_like(p.get_value(borrow=True))) for p in params] updates = [] for s, p, gp, m, h in zip(stepsizes, params, grads, momentum, headings): updates.append((p, p + s * h)) - updates.append((h, m*h - (1-m)*gp)) + updates.append((h, m*h - (1.0-m)*gp)) return updates