<s> import numpy as np <EOL> import theano . tensor as T <EOL> import theano <EOL> def rprop_core ( params , gradients , rprop_increase = <NUM_LIT> , rprop_decrease = <NUM_LIT> , rprop_min_step = <NUM_LIT:0> , rprop_max_step = <NUM_LIT:100> , <EOL> learning_rate = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> for param , grad in zip ( params , gradients ) : <EOL> grad_tm1 = theano . shared ( np . zeros_like ( param . get_value ( ) ) , name = param . name + '<STR_LIT>' ) <EOL> step_tm1 = theano . shared ( np . zeros_like ( param . get_value ( ) ) + learning_rate , name = param . name + '<STR_LIT>' ) <EOL> test = grad * grad_tm1 <EOL> same = T . gt ( test , <NUM_LIT:0> ) <EOL> diff = T . lt ( test , <NUM_LIT:0> ) <EOL> step = T . minimum ( rprop_max_step , T . maximum ( rprop_min_step , step_tm1 * ( <EOL> T . eq ( test , <NUM_LIT:0> ) + <EOL> same * rprop_increase + <EOL> diff * rprop_decrease ) ) ) <EOL> grad = grad - diff * grad <EOL> yield param , param - T . sgn ( grad ) * step <EOL> yield grad_tm1 , grad <EOL> yield step_tm1 , step </s>
