<s> """<STR_LIT>""" <EOL> import theano <EOL> import theano . tensor as T <EOL> from lasagne . updates import get_or_compute_grads <EOL> from collections import OrderedDict <EOL> import numpy as np <EOL> def deepmind_rmsprop ( loss_or_grads , params , learning_rate , <EOL> rho , epsilon ) : <EOL> """<STR_LIT>""" <EOL> grads = get_or_compute_grads ( loss_or_grads , params ) <EOL> updates = OrderedDict ( ) <EOL> for param , grad in zip ( params , grads ) : <EOL> value = param . get_value ( borrow = True ) <EOL> acc_grad = theano . shared ( np . zeros ( value . shape , dtype = value . dtype ) , <EOL> broadcastable = param . broadcastable ) <EOL> acc_grad_new = rho * acc_grad + ( <NUM_LIT:1> - rho ) * grad <EOL> acc_rms = theano . shared ( np . zeros ( value . shape , dtype = value . dtype ) , <EOL> broadcastable = param . broadcastable ) <EOL> acc_rms_new = rho * acc_rms + ( <NUM_LIT:1> - rho ) * grad ** <NUM_LIT:2> <EOL> updates [ acc_grad ] = acc_grad_new <EOL> updates [ acc_rms ] = acc_rms_new <EOL> updates [ param ] = ( param - learning_rate * <EOL> ( grad / <EOL> T . sqrt ( acc_rms_new - acc_grad_new ** <NUM_LIT:2> + epsilon ) ) ) <EOL> return updates </s>
