#NEWLINE# def get_updates( self , params , constraints , grads ) : #NEWLINE# #INDENT# accumulators = [ np . zeros_like ( p ) for p in params ] #NEWLINE# delta_accumulators = [ np . zeros_like ( p ) for p in params ] #NEWLINE# new_weights = [ ] #NEWLINE# for ( p , g , a , d_a , c ) in zip ( params , grads , accumulators , accumulators , constraints ) : #NEWLINE# #INDENT# new_a = ( ( self . rho * a ) + ( ( 1 - self . rho ) * ( g ** 2 ) ) ) #NEWLINE# self . updates . append ( ( a , new_a ) ) #NEWLINE# div = np . sqrt ( ( new_a + self . epsilon ) ) #NEWLINE# update = ( ( g * np . sqrt ( ( d_a + self . epsilon ) ) ) / div ) #NEWLINE# new_p = ( p - ( self . lr * update ) ) #NEWLINE# self . updates . append ( ( p , c ( new_p ) ) ) #NEWLINE# new_weights . append ( new_p ) #NEWLINE# #UNINDENT# return new_weights