Skip to content

Instantly share code, notes, and snippets.

@alextp

alextp/arow.py

Created Jan 7, 2012
Embed
What would you like to do?
arow
# a short implementation of arow in theano
def arow(params, loss, lbda1, lbda2):
sigma = [theano.shared(value=np.ones(p.value.shape)) for p in params]
gl = [T.grad(cost=loss, wrt=p) for p in params]
ups = {}
for i in xrange(len(params)):
ups[params[i]] = params[i] - lbda1*gl[i]/sigma[i]
ups[sigma[i]] = sigma[i] + lbda2*gl[i]*gl[i]
return ups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment