#NEWLINE# def _get_directions( self ) : #NEWLINE# #INDENT# ' Produces descending directions. ' #NEWLINE# directions = OrderedDict ( ) #NEWLINE# for ( i , ( param , gradient ) ) in enumerate ( self . loss . gradients . items ( ) ) : #NEWLINE# #INDENT# param_name = ( param . name if ( param . name is not None ) else str ( i ) ) #NEWLINE# sum_squared_grad = sharedX ( np . zeros_like ( param . get_value ( ) ) , name = ( 'sum_squared_grad_' + param_name ) ) #NEWLINE# self . parameters [ sum_squared_grad . name ] = param #NEWLINE# new_sum_squared_grad = ( sum_squared_grad + T . sqr ( gradient ) ) #NEWLINE# root_sum_squared = T . sqrt ( ( new_sum_squared_grad + self . eps ) ) #NEWLINE# self . _updates [ sum_squared_grad ] = new_sum_squared_grad #NEWLINE# directions [ param ] = ( ( - ( self . lr / root_sum_squared ) ) * gradient ) #NEWLINE# #UNINDENT# return directions