#NEWLINE# def optimize( self , x , model ) : #NEWLINE# #INDENT# evaluator = ModelEvaluator ( model ) #NEWLINE# data_bounds = np . repeat ( [ ( ( - 103.939 ) , ( 255.0 - 103.939 ) , ( - 116.779 ) , ( 255.0 - 116.779 ) , ( - 123.68 ) , ( 255 - 123.68 ) ) ] , ( np . product ( x . shape ) // 3 ) , axis = 0 ) . reshape ( ( np . product ( x . shape ) , 2 ) ) #NEWLINE# ( x , min_val , info ) = fmin_l_bfgs_b ( evaluator . loss , x . flatten ( ) , fprime = evaluator . grads , maxfun = 20 , maxiter = 20 , factr = 10000000.0 , m = 4 , bounds = data_bounds , iprint = 0 ) #NEWLINE# return ( x , info , info )