Wayne H Nixalo - 09 Aug 2017

FADL2 L9: Generative Models

neural-style-GPU.ipynb


In [33]:
%matplotlib inline
import importlib
import os, sys
sys.path.insert(1, os.path.join('../utils'))
from utils2 import *

from scipy.optimize import fmin_l_bfgs_b
from scipy.misc import imsave
from keras import metrics

from vgg16_avg import VGG16_Avg

In [2]:
limit_mem()

In [4]:
path = '../data/nst/'

In [14]:
# names = os.listdir(path)
# pkl_out = open('fnames.pkl','wb')
# pickle.dump(names, pkl_out)
# pkl_out.close()

fnames = pickle.load(open(path + 'fnames.pkl', 'rb'))

In [16]:
fnames = glob.glob(path+'**/*.JPG', recursive=True)
fn = fnames[0]

In [17]:
fn


Out[17]:
'../data/nst/IMG_2934.JPG'

In [18]:
img = Image.open(fn); img


Out[18]:

In [19]:
# Subtracting mean and reversing color-channel order:
rn_mean = np.array([123.68,116.779,103.939], dtype=np.float32)
preproc = lambda x: (x - rn_mean)[:,:,:,::-1]

# later undoing preprocessing for image generation
deproc = lambda x,s: np.clip(x.reshape(s)[:,:,:,::-1] + rn_mean, 0, 255)

img_arr = preproc(np.expand_dims(np.array(img), 0))
shp     = img_arr.shape

Content Recreation


In [30]:
# had to fix some compatibility issues w/ Keras 1 -> Keras 2
import vgg16_avg
importlib.reload(vgg16_avg)
from vgg16_avg import VGG16_Avg

In [31]:
model = VGG16_Avg(include_top=False)
# grabbing activations from near the end of the CNN model
layer = model.get_layer('block5_conv1').output
# calculating layer's target activations
layer_model = Model(model.input, layer)
targ = K.variable(layer_model.predict(img_arr))


../utils/vgg16_avg.py:56: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), activation="relu", name="block1_conv1", padding="same")`
  x = Convolution2D(64, 3, 3, activation='relu', border_mode='same', name='block1_conv1')(img_input)
../utils/vgg16_avg.py:57: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), activation="relu", name="block1_conv2", padding="same")`
  x = Convolution2D(64, 3, 3, activation='relu', border_mode='same', name='block1_conv2')(x)
../utils/vgg16_avg.py:61: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), activation="relu", name="block2_conv1", padding="same")`
  x = Convolution2D(128, 3, 3, activation='relu', border_mode='same', name='block2_conv1')(x)
../utils/vgg16_avg.py:62: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), activation="relu", name="block2_conv2", padding="same")`
  x = Convolution2D(128, 3, 3, activation='relu', border_mode='same', name='block2_conv2')(x)
../utils/vgg16_avg.py:66: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), activation="relu", name="block3_conv1", padding="same")`
  x = Convolution2D(256, 3, 3, activation='relu', border_mode='same', name='block3_conv1')(x)
../utils/vgg16_avg.py:67: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), activation="relu", name="block3_conv2", padding="same")`
  x = Convolution2D(256, 3, 3, activation='relu', border_mode='same', name='block3_conv2')(x)
../utils/vgg16_avg.py:68: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), activation="relu", name="block3_conv3", padding="same")`
  x = Convolution2D(256, 3, 3, activation='relu', border_mode='same', name='block3_conv3')(x)
../utils/vgg16_avg.py:72: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block4_conv1", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv1')(x)
../utils/vgg16_avg.py:73: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block4_conv2", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv2')(x)
../utils/vgg16_avg.py:74: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block4_conv3", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv3')(x)
../utils/vgg16_avg.py:78: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block5_conv1", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block5_conv1')(x)
../utils/vgg16_avg.py:79: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block5_conv2", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block5_conv2')(x)
../utils/vgg16_avg.py:80: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), activation="relu", name="block5_conv3", padding="same")`
  x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block5_conv3')(x)
Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5
58728448/58889256 [============================>.] - ETA: 0s

In this implementation, need to define an object that'll allow us to separately access the loss function and gradients of a function,


In [34]:
class Evaluator(object):
    def __init__(self, f, shp): self.f, self.shp = f, shp
    
    def loss(self, x):
        loss_, self.grad_values = self.f([x.reshape(self.shp)])
        return loss_.astype(np.float64)
    
    def grads(self, x): return self.grad_values.flatten().astype(np.float64)

# Define loss function to calc MSE betwn the 2 outputs at specfd Conv layer
loss = metrics.mse(layer, targ)
grads = K.gradients(loss, model.input)
fn = K.function([model.input], [loss]+grads)
evaluator = Evaluator(fn, shp)

# optimize loss fn w/ deterministic approach using Line Search
def solve_image(eval_obj, niter, x):
    for i in range(niter):
        x, min_val, info = fmin_l_bfgs_b(eval_obj.loss, x.flatten(),
                                         fprime=eval_obj.grads, maxfun=20)
        x = np.clip(x, -127,127)
        print('Current loss value:', min_val)
        imsave(f'{path}/results/res_at_iteration_{i}.png', deproc(x.copy(), shp)[0])
    return x

In [35]:
# generating a random image:
rand_img = lambda shape: np.random.uniform(-2.5,2.5,shape)/100
x = rand_img(shp)
plt.imshow(x[0])


Out[35]:
<matplotlib.image.AxesImage at 0x7fc688851898>

In [36]:
iterations = 10
x = solve_image(evaluator, iterations, x)


Current loss value: [[[  36.84698486   25.31944656   19.05295372   26.72929001   42.29379272
     42.4466095    36.8651123    25.77234459   31.87740707   43.05461121
     47.14723969   48.08355713   85.19512177   74.53987122   90.32463837
     52.39159012   59.66118622   64.09477234   35.54707336   19.38749695
     26.45584297   29.91149139   31.43980217   29.77198219   24.52454376
     25.90310478   28.49525833   26.08754349   22.75306129   19.04619026]
  [  22.21642303   20.12755775   14.17131519   17.12739944   22.81347847
     16.16996193   11.96669006   14.62566471   21.61488914   29.53083038
     34.73329544   46.74581909   58.82113266   44.07838821   41.14895248
     40.42720032   86.28344727   69.63314056   23.93707848   14.28123856
     15.62097168   15.23616982   14.34072685   18.44782257   14.81083012
     15.40630436   17.61517525   17.93347931   15.7487011     9.74167347]
  [  19.57742691   24.88094711   21.20959854   17.02429199   16.04206276
     11.64803505   10.16344929   12.62602997   16.65310097   25.14056969
     29.60168839   37.40457916   39.83079147   33.47225952   40.24455261
     61.45488358   66.42613983   37.97806549   19.88283157   28.19946861
     17.68590546   13.24964905   11.38617039   16.90208817   11.6660862
      8.5124836     8.11018372    6.87087727    5.87622786    2.94226074]
  [  24.40624619   15.42626762   18.24381447    6.81579018    5.53282499
      5.63473511    8.45338249    8.4103384     8.87650013   17.13197708
     23.67867279   32.10264587   44.59202576   32.94459915   36.64169312
     39.07665253   24.5747242    18.97734261   22.58559418   34.4894104
     12.30844021    7.7691474     9.11991692   14.07856178   10.26850605
      5.20890141    4.51819086    3.01186919    3.99798989    2.35131383]
  [  26.87335777   15.99230289   19.77634048    3.67461252    3.19781733
      6.18075562    8.52385235    6.16398668    8.44408417   24.09635544
     28.84062576   36.3432312    44.44422913   53.32261658   68.31532288
     49.60505676   23.63946724   17.21792221   18.50744629   19.89505196
      7.37253666    7.82778835   10.797122     12.28849411    5.79283428
      5.47257423    6.13826084    3.15261173    3.26059103    1.87902093]
  [  26.45553017   17.74158478   16.85414886    3.78730512    3.2499392
      6.68403816   10.29344177    8.42188072    7.20945787   17.12720108
     25.45149994   27.18572235   32.21635437   61.92987061   95.58205414
     68.22597504   26.26948357   12.86272621   14.63485718   13.04049397
      8.16737556    8.45832062    7.9544158     9.22803879    7.23541212
      6.62557316    5.65645504    3.79809713    3.68650341    2.06147599]
  [  25.8517971    17.26992607   12.12336731    5.14541531    7.16089058
     11.14670753   12.56089401   10.79888725    9.35702038   15.82734203
     20.5882206    34.31065369   54.4598465    73.07779694   73.4697876
     50.30710602   25.76651001   17.26823044   18.06002808   15.44981956
     10.02947426    8.83589935    8.91701508    9.05738354    7.94933319
      6.5726099     4.43359947    3.49646997    3.06789565    1.83218074]
  [  25.37178421   13.54181576   10.49773502    7.04174232   13.28252792
     13.06725311    9.067523      8.00564098    9.4465065    17.76525879
     22.64673233   33.83179474   64.70851898   79.98925781   70.03173065
     44.53315735   29.77414322   23.86408806   14.68952751   13.13087177
     11.11766434   11.78374577   12.24998283   11.04081535    6.25272083
      6.22565126    6.83769417    5.50280142    5.01274967    2.64517593]
  [  24.53227234   18.75757217   13.19798946    6.11932945   11.43343353
      9.31463909    4.99764633    6.56747627    9.12177849   14.71486187
     23.46367073   34.51398849   66.44445038   95.44490814   91.27098083
     53.69154358   31.95396042   16.58475876   11.88929558   13.57168579
     20.56903458   24.88650894   14.85542774    9.25181198    5.18660927
      6.56328392    6.55052662    3.88092685    4.33286667    3.75772047]
  [  30.24384308   28.41597939   30.39845276    8.5997715     8.89387512
      6.86919117    5.81216621    7.89536762    9.59887505   18.69369698
     24.69238281   36.85797119   58.10764313   82.20747375   87.02401733
     50.94883728   32.12088013   19.54047394   15.52814102   20.06283569
     32.51378632   30.65533066   13.7529583     7.76801252    7.33967113
      7.19772625    4.89906979    3.26389647    4.22839546    3.49560356]
  [  28.34803391   21.94883537   28.91997147   10.76468468    7.13177299
      8.67141533   12.28576565   15.47183514   18.61813164   27.48226357
     24.83708954   31.96836472   43.7817955    54.18900299   65.69287872
     42.41088104   27.03790665   18.83018875   17.08436584   22.90012741
     31.19622421   31.11083412   16.33236122   12.39691544    8.6929493
      3.90506887    1.99953854    2.80636644    4.92864609    3.88765454]
  [  22.45912552   17.92282867   20.95874023    9.88591957    6.28069115
      9.02432346   18.15258598   23.93291473   19.27668571   15.97152328
     15.61698723   17.87669373   25.29166985   34.23241425   52.69477844
     46.93331146   29.00650024   22.22669792   27.63790321   22.48548317
     21.26208878   21.70257187   21.99739647   24.43920898   17.40029526
      7.02110052    2.49624777    2.39991283    5.014925      3.82599163]
  [  18.43977356   16.39016533   14.42775345    5.85423756    5.9852705
      6.19780207   11.73160362   19.43947983   19.90852737   12.40694714
     13.27849865   17.49628448   22.2340641    26.68162155   49.06315231
     38.82772064   23.60436249   22.04231262   30.39455986   20.49438858
     20.21575165   24.99136353   37.62200928   39.53920364   25.60078239
     10.50090027    3.13724709    3.3449297     5.14494038    4.5373311 ]
  [  17.40605354   12.18313026    9.03986168    5.21709347    7.51325178
      9.10673523    9.75004768    8.64521694   12.10320187   10.93111706
     10.19101048   12.98019409   17.95272446   33.69387054   65.46780396
     29.09403801   18.15204239   20.86292267   29.81663513   24.57368469
     20.67206001   20.21802139   29.35870743   26.54339218   12.58208466
      7.10161877    4.06659985    4.23154736    5.71033764    4.80606461]
  [  17.83746338   12.84800339    8.1638298     6.63124752   10.76703644
     11.45411873    7.76015615    7.95398855   10.78273106    8.27191067
      6.82434797    9.52967834   16.6133461    50.29860687   79.9420929
     42.0272522    26.55464554   27.79265594   30.02518082   24.32280731
     20.0477066    13.52071571   15.44428253   13.95771122    9.93310738
      7.89379883    4.19698668    4.78543758    6.63001633    5.06693554]
  [  15.87668419   12.40820312    9.14640331    7.68857956   10.15717316
     11.66932297    6.36829615    7.34377575    7.74601841    6.33887291
      7.36724186   16.17697906   29.36457253   52.00777817   60.42685699
     33.48775482   29.77257729   26.91317368   23.27618408   22.38869476
     24.21271706   19.39748764   14.68226147   11.61074066    7.50149012
      5.68187237    4.44064522    4.98696613    6.45942307    5.17210197]
  [  12.92306232    7.95920944    6.06601667   10.36039352   12.97352886
     16.72977829    8.81846237   10.36949921   11.23659515    9.59153461
     12.94584274   27.84108162   57.81919098   84.53384399  158.97982788
     96.08143616   39.97628784   36.37443542   17.84990311   18.42169571
     20.56800461   18.79102516   12.70943356    8.20521832    9.50011921
      8.5895071     6.60711384    5.65675545    7.18488026    6.09510231]
  [  13.41681671    8.2195797     6.74190235    9.44470978   14.1685257
     19.90387344   10.35804081   10.98664856   16.0337944    10.04139328
     13.97473335   40.07172394   75.31188202  157.07867432  221.30093384
    141.07743835   63.88210297   41.61660767   17.59001923    9.89108372
     12.46729946   12.50958061    8.70855522    6.99825382    9.87698174
      8.36843109    7.00560474    7.17883968    8.74594307    6.30434465]
  [  14.82688713    8.23512077    7.46528912    6.24091816   10.63988495
     16.17170715    9.6863308     7.05316448    9.52746391    6.90135098
     12.93098068   49.90251923   59.80786896  103.92541504  112.2303009
    123.23220062   67.03277588   42.96932983   16.46970749    4.6576643
      6.2024827     6.01095867    5.11962032    6.86762714    9.63426685
      8.87859917    7.8537941     8.56534004    9.5058136     5.40066576]
  [  13.32890129    6.97966862    8.82277107    7.36613703    9.64198303
      8.00553703    6.77865744    6.98492098   14.47236919   17.65263748
     17.45125198   46.01140213   69.63754272   76.97796631  115.1215744
    124.47766113   60.82207489   60.35151291   34.93093109   11.67560577
      7.90226078   10.85835361   16.95126343   18.67480087   12.83389568
      8.03400803    5.77185917    6.93891668    7.3060894     5.10761261]
  [  12.36916161    8.90360451   11.29246426   10.47753143   11.32680321
     12.50506592   18.91886902   24.37705612   35.46416473   36.72691727
     27.67515182   44.17044067   59.84904861   91.03405762  191.73422241
    151.20932007   70.83256531   74.16079712   72.44602966   32.93637085
     13.30335331   12.28443527   17.43498993   13.1918335    10.36067772
      9.12405014    5.47388077    9.45927048   11.95039082    8.59208679]
  [  15.34762383   12.47671509   11.64379501    7.6903429    10.93289661
     17.0461731    33.66313934   43.13021088   47.31269073   52.15312958
     45.11149216   66.37770844   77.33177185  108.38127899  277.49377441
    200.55682373   79.69937134   53.88995743   69.45628357   63.19589996
     36.29901123   23.2282753    20.3712883    20.34020424   17.75492287
     13.89548492    9.25919724   14.74749851   14.49842072    8.75744247]
  [  22.3662796    16.6730423    13.62574673   11.75206947   16.37050629
     20.52509308   35.53752899   45.85739517   62.18890762   71.23145294
     58.08383942   83.28904724  110.62566376   95.90843964  144.96954346
    157.08380127   97.85627747   80.44046021   72.07536316   60.6656723
     56.9094162    49.90436172   33.9822464    26.72576141   20.5460453
     11.2945776     8.23498726   12.28023911   12.34329128    7.12724972]
  [  25.51141739   24.42103386   18.26966476   16.24827194   34.27363205
     57.97428513   81.32649231   81.38375854   68.28410339   59.75276184
     57.32948303   74.76094055   69.51121521   57.37756348   97.80252075
     99.40531921  112.53370667  130.19979858  148.98825073  107.54998779
     96.45822144   53.4659996    37.10967255   32.7314682    28.58465767
     14.98313427    8.48437881    6.36657619    5.71120358    3.36257386]
  [  23.8848877    28.83255196   31.44088936   39.28152847   53.20536423
     62.94708252   82.9467392    78.57965088   57.5449295    53.00551605
     53.05452728   58.59263611   42.36648941   50.00153732   98.83109283
    108.10786438  120.09384155  106.36047363   97.85395813   98.98187256
    127.3739624    80.01171875   45.42490005   40.44134903   39.63466644
     27.26070404   13.84435844    9.49979973    5.87198687    4.35484314]
  [  32.40687561   43.72882843   42.99148941   58.60381317   73.90912628
     70.76618958   81.97972107   67.19429016   40.3654747    36.19136047
     42.86167145   48.11315536   61.81523132   89.37221527  131.33099365
    130.08872986  161.70274353  123.66903687  105.64864349   90.46429443
     75.36128235   56.42850494   45.50717926   54.66439819   47.49055862
     41.03205872   33.25825882   25.42322922   13.61657143    8.71987724]
  [  43.88284302   56.1951828    56.03739166   71.01376343   82.01865387
     58.73814392   45.57513428   34.0021553    29.03989792   34.26357269
     51.95457458   85.48791504  113.65590668  121.20000458  152.26501465
    122.58648682  147.99058533   95.32862854   68.63296509   48.84579468
     52.23950577   35.83456802   19.57123566   30.46207809   56.70370483
     61.32459259   45.59409332   40.01547241   31.05666924   17.55149841]
  [  64.57681274   53.73843384   61.21253967   53.78304291   45.05437088
     40.00626755   24.25611115   18.12685394   36.25395966   48.68135071
     61.62170029  126.84129333  122.94155884   73.26490021  107.58103943
    103.00952148  107.86577606   83.10978699   71.80714417   30.18749619
     45.49108887   24.78409958   22.72003174   23.46670914   28.32693291
     38.0867691    48.63722992   54.59058762   41.83346176   25.50140762]
  [  58.92792511   38.82582855   27.78372574   19.36591911   24.84260559
     27.1991806    21.28651428   22.97083664   49.04473114   82.04023743
     99.39442444  147.70066833  148.47434998   77.59602356  131.71847534
    134.8193512    76.17941284   89.22505188   55.28446579   32.30503845
     45.40515137   18.71821594   15.88380909   16.34761238   12.24054718
     15.26989937   20.28105927   27.02042198   26.60529327   24.70442581]
  [  20.64253807   11.56664467   15.41681671   14.35499001   16.37995529
     15.45108986   18.79897118   17.1397934    39.81903458  103.99052429
    169.33856201  240.32829285  193.15710449  171.08969116  174.88760376
    135.57946777   60.07051086  100.17845154   59.42309952   41.82769775
     42.23598099   21.28861046   15.24238014   12.95484829   12.74480915
     16.58581543   22.25796127   22.15008926   13.50793076   10.06123829]
  [  12.25784016   18.22787476   18.90585136   13.06529522   12.32592773
     12.14874744   15.29203796   10.27048492   30.85258102   95.57675934
     78.07905579  133.1736145   233.03341675  265.17132568  254.25457764
    143.09393311   72.55413818   96.28755188   85.16819763   55.58297729
     39.92942047   22.08545303   15.01264      10.49587822   10.49056435
     11.30630589    8.20960236   11.45411396   15.90427589   10.2773037 ]
  [  15.46028709   22.8337822    14.23488998    8.08880901    9.63381958
     10.85446739   12.08478737   10.89756012   24.11711311   59.775383
     40.07528687   54.23450851  126.96957397  177.54508972  181.17320251
    131.85987854  113.82424927   94.39466095  101.8812561    68.80290222
     47.09579086   26.21854782   14.34534359   10.64760208   10.432024
      7.93575144    6.12837315    4.89411116    7.11410427    7.29241514]
  [  18.36441803   17.83355713   13.44521713   10.08459091   11.03539181
      9.91426468   10.00385952   10.65867329   14.48249149   26.4181118
     32.2106781    79.1705246   180.64855957  168.05621338  138.61766052
    119.2815094   117.95308685   93.19009399   79.06348419   70.38059235
     48.69833755   19.19200134   12.10754395   11.32983589   11.88951683
      9.86532784    9.08862495    5.35394239    5.78888607    4.88436556]
  [  23.32094765   17.23487473   19.33973694   12.71365833   13.96926498
     14.15538788   13.8437624    15.97000885   18.43057442   19.27611542
     33.15295792   91.51343536  194.79109192  127.67789459   89.21136475
     93.28656769   98.07833099   83.68389893   39.66999435   52.35884476
     61.16949463   21.56866455   14.70232964   11.9698391    10.52364063
     10.12268734    9.04450989    6.45737171    6.11844826    3.315485  ]
  [  21.21501923   21.02568054   23.01258469   18.50439644   19.30807877
     18.42882729   20.52475929   20.34321594   24.98872375   24.61051941
     32.12915039   76.94655609  168.42163086  120.6122818    85.80828094
     82.14523315   77.80343628   93.95788574   44.42737579   41.62348175
     58.21009827   28.92624855   19.01431847   14.96493435   13.26146126
      8.46161842    8.47590065   13.7780838    13.8588829     9.17165756]
  [  20.36188126   23.21292496   20.44061279   18.9383049    14.40534019
     10.28686619   14.75067997   17.37759399   20.64077759   19.19107819
     22.46326828   50.94835663  137.35231018  137.5605011   110.46740723
    116.71665955  125.47678375  127.11965179   59.7733078    38.12215424
     45.57209015   27.78456116   21.71836853   17.16754913   16.80397224
     10.68183899   11.18337631   20.78020096   21.17416954   12.80300045]
  [  24.28636551   16.67528152   13.44419384   11.51244164    8.58687496
      8.52274132   12.03186226   15.30235386   14.16750336   15.19782639
     17.84117699   34.35378265   83.87304688   92.9213028    88.23625183
    110.84188843   81.92664337   93.53409576   55.79325104   26.9896431
     16.72430801   13.69436169   14.19398212   11.08281517   11.22804642
      9.05599117    7.7480526    12.15108204   15.49998856   10.67177582]]]
Current loss value: [[[  36.84698486   25.31944656   19.05295372   26.72929001   42.29379272
     42.4466095    36.8651123    25.77234459   31.87740707   43.05461121
     47.14723969   48.08355713   85.19512177   74.53987122   90.32463837
     52.39159012   59.66118622   64.09477234   35.54707336   19.38749695
     26.45584297   29.91149139   31.43980217   29.77198219   24.52454376
     25.90310478   28.49525833   26.08754349   22.75306129   19.04619026]
  [  22.21642303   20.12755775   14.17131519   17.12739944   22.81347847
     16.16996193   11.96669006   14.62566471   21.61488914   29.53083038
     34.73329544   46.74581909   58.82113266   44.07838821   41.14895248
     40.42720032   86.28344727   69.63314056   23.93707848   14.28123856
     15.62097168   15.23616982   14.34072685   18.44782257   14.81083012
     15.40630436   17.61517525   17.93347931   15.7487011     9.74167347]
  [  19.57742691   24.88094711   21.20959854   17.02429199   16.04206276
     11.64803505   10.16344833   12.62602901   16.65310097   25.14056969
     29.60168839   37.40457916   39.83079147   33.47225952   40.24455261
     61.45488358   66.42613983   37.97806549   19.88283157   28.19946861
     17.68590546   13.24964905   11.38617039   16.90208817   11.6660862
      8.5124836     8.11018372    6.87087727    5.87622786    2.94226074]
  [  24.40624619   15.42626762   18.24381447    6.81579018    5.53282499
      5.63473511    8.45338249    8.4103384     8.87650013   17.13197708
     23.67867279   32.10264587   44.59202576   32.94459915   36.64169312
     39.07665253   24.5747242    18.97734261   22.58559418   34.4894104
     12.30844021    7.7691474     9.11991692   14.07856178   10.26850605
      5.20890141    4.51819086    3.01186919    3.99798989    2.35131383]
  [  26.87335777   15.99230289   19.77634048    3.67461252    3.19781733
      6.18075562    8.52385235    6.16398668    8.44408417   24.09635544
     28.84062576   36.3432312    44.44422913   53.32261658   68.31532288
     49.60505676   23.63946724   17.21792221   18.50744629   19.89505196
      7.37253666    7.82778835   10.797122     12.28849411    5.79283428
      5.47257423    6.13826084    3.15261173    3.26059103    1.87902093]
  [  26.45552826   17.74158478   16.85414886    3.78730512    3.2499392
      6.68403816   10.29344177    8.42188072    7.20945787   17.12720108
     25.45149994   27.18572235   32.21635437   61.92987061   95.58205414
     68.22597504   26.26948357   12.86272621   14.63485718   13.04049397
      8.16737556    8.45832062    7.9544158     9.22803879    7.23541212
      6.62557316    5.65645504    3.79809713    3.68650341    2.06147599]
  [  25.8517971    17.26992798   12.12336731    5.14541531    7.16089058
     11.14670753   12.56089401   10.79888725    9.35702038   15.82734203
     20.5882206    34.31065369   54.4598465    73.07779694   73.4697876
     50.30710602   25.76651001   17.26823044   18.06002808   15.44981956
     10.02947426    8.83589935    8.91701508    9.05738354    7.94933319
      6.5726099     4.43359947    3.49646997    3.06789565    1.83218074]
  [  25.37178421   13.54181576   10.49773502    7.04174232   13.28252792
     13.06725311    9.067523      8.00564098    9.4465065    17.76525879
     22.64673233   33.83179474   64.70851898   79.98925781   70.03173065
     44.53315735   29.77414322   23.86408806   14.68952751   13.13087177
     11.11766434   11.78374577   12.24998283   11.04081535    6.25272083
      6.22565126    6.83769417    5.50280142    5.01274967    2.64517593]
  [  24.53227234   18.75757217   13.19798946    6.11932945   11.43343353
      9.31463909    4.99764633    6.56747627    9.12177849   14.71486187
     23.46367073   34.51398849   66.44445038   95.44490814   91.27098083
     53.69154358   31.95396042   16.58475876   11.88929558   13.57168579
     20.56903458   24.88650894   14.85542774    9.25181198    5.18660927
      6.56328392    6.55052662    3.88092685    4.33286667    3.75772047]
  [  30.24384308   28.41597939   30.39845276    8.5997715     8.89387417
      6.86919117    5.81216621    7.89536762    9.59887505   18.69369698
     24.69238281   36.85797119   58.10764313   82.20747375   87.02401733
     50.94883728   32.12088013   19.54047394   15.52814102   20.06283569
     32.51378632   30.65533066   13.7529583     7.76801252    7.33967113
      7.19772625    4.89906979    3.26389647    4.22839546    3.49560356]
  [  28.34803391   21.94883537   28.91997147   10.76468468    7.13177299
      8.67141533   12.28576565   15.47183514   18.61813164   27.48226357
     24.83708954   31.96836472   43.7817955    54.18900299   65.69287872
     42.41088104   27.03790665   18.83018875   17.08436584   22.90012741
     31.19622421   31.11083412   16.33236122   12.39691544    8.6929493
      3.90506887    1.99953854    2.80636644    4.92864609    3.88765454]
  [  22.45912552   17.92282867   20.95874023    9.88591957    6.28069115
      9.02432346   18.15258598   23.93291473   19.27668571   15.97152328
     15.61698723   17.87669373   25.29166985   34.23241425   52.69477844
     46.93331146   29.00650024   22.22669792   27.63790321   22.48548317
     21.26208878   21.70257187   21.99739647   24.43920898   17.40029526
      7.02110052    2.49624777    2.39991283    5.014925      3.82599163]
  [  18.43977356   16.39016533   14.42775345    5.85423756    5.9852705
      6.19780207   11.73160362   19.43947983   19.90852737   12.40694714
     13.27849865   17.49628448   22.2340641    26.68162155   49.06315231
     38.82772064   23.60436249   22.04231262   30.39455986   20.49438858
     20.21575165   24.99136353   37.62200928   39.53920364   25.60078239
     10.50090027    3.13724709    3.3449297     5.14494038    4.5373311 ]
  [  17.40605354   12.18313026    9.03986168    5.21709347    7.51325178
      9.10673523    9.75004768    8.64521694   12.10320187   10.93111706
     10.19101048   12.98019409   17.95272446   33.69387054   65.46780396
     29.09403801   18.15204239   20.86292267   29.81663513   24.57368469
     20.67206001   20.21802139   29.35870743   26.54339218   12.58208466
      7.10161877    4.06659985    4.23154736    5.71033764    4.80606461]
  [  17.83746338   12.84800339    8.1638298     6.63124752   10.76703644
     11.45411873    7.76015615    7.95398855   10.78273106    8.27191067
      6.82434797    9.52967834   16.6133461    50.29860687   79.9420929
     42.0272522    26.55464554   27.79265594   30.02518082   24.32280731
     20.0477066    13.52071571   15.44428253   13.95771122    9.93310738
      7.89379883    4.19698668    4.78543758    6.63001633    5.06693554]
  [  15.87668419   12.40820312    9.14640331    7.68857956   10.15717316
     11.66932297    6.36829615    7.34377575    7.74601841    6.33887291
      7.36724186   16.17697906   29.36457253   52.00777817   60.42685699
     33.48775482   29.77257729   26.91317368   23.27618408   22.38869476
     24.21271706   19.39748764   14.68226147   11.61074066    7.50149012
      5.68187237    4.44064522    4.98696613    6.45942307    5.17210197]
  [  12.92306232    7.95920944    6.06601667   10.36039352   12.97352886
     16.72977829    8.81846237   10.36949921   11.23659515    9.59153461
     12.94584274   27.84108162   57.81919098   84.53384399  158.97982788
     96.08143616   39.97628784   36.37443542   17.84990311   18.42169571
     20.56800461   18.79102516   12.70943356    8.20521832    9.50011921
      8.5895071     6.60711384    5.65675545    7.18488026    6.09510231]
  [  13.41681671    8.2195797     6.74190235    9.44470978   14.1685257
     19.90387344   10.35804081   10.98664856   16.0337944    10.04139328
     13.97473335   40.07172394   75.31188202  157.07867432  221.30093384
    141.07743835   63.88210297   41.61660767   17.59001923    9.89108372
     12.46729946   12.50958061    8.70855522    6.99825382    9.87698174
      8.36843109    7.00560474    7.17883968    8.74594307    6.30434465]
  [  14.82688713    8.23512077    7.46528912    6.24091816   10.63988495
     16.17170715    9.6863308     7.05316448    9.52746391    6.90135098
     12.93098068   49.90251923   59.80786896  103.92541504  112.2303009
    123.23220062   67.03277588   42.96932983   16.46970749    4.6576643
      6.2024827     6.01095867    5.11962032    6.86762714    9.63426685
      8.87859917    7.8537941     8.56534004    9.5058136     5.40066576]
  [  13.32890129    6.97966862    8.82277107    7.36613703    9.64198303
      8.00553703    6.77865744    6.98492098   14.47236919   17.65263748
     17.45125198   46.01140213   69.63754272   76.97796631  115.1215744
    124.47766113   60.82207489   60.35151291   34.93093109   11.67560577
      7.90226078   10.85835361   16.95126343   18.67480087   12.83389568
      8.03400803    5.77185917    6.93891668    7.3060894     5.10761261]
  [  12.36916161    8.90360451   11.29246426   10.47753143   11.32680321
     12.50506592   18.91886902   24.37705612   35.46416473   36.72691727
     27.67515182   44.17044067   59.84904861   91.03405762  191.73422241
    151.20932007   70.83256531   74.16079712   72.44602966   32.93637085
     13.30335331   12.28443527   17.43498993   13.1918335    10.36067772
      9.12405014    5.47388077    9.45927048   11.95039082    8.59208679]
  [  15.34762383   12.47671509   11.64379501    7.6903429    10.93289661
     17.0461731    33.66313934   43.13021088   47.31269073   52.15312958
     45.11149216   66.37770844   77.33177185  108.38127899  277.49377441
    200.55682373   79.69937134   53.88995743   69.45628357   63.19589996
     36.29901123   23.2282753    20.3712883    20.34020424   17.75492287
     13.89548492    9.25919724   14.74749851   14.49842072    8.75744247]
  [  22.3662796    16.6730423    13.62574673   11.75206947   16.37050629
     20.52509308   35.53752899   45.85739517   62.18890762   71.23145294
     58.08383942   83.28904724  110.62566376   95.90843964  144.96954346
    157.08380127   97.85627747   80.44046021   72.07536316   60.6656723
     56.9094162    49.90436172   33.9822464    26.72576141   20.5460453
     11.2945776     8.23498726   12.28023911   12.34329128    7.12724972]
  [  25.51141739   24.42103386   18.26966476   16.24827194   34.27363205
     57.97428513   81.32649231   81.38375854   68.28410339   59.75276184
     57.32948303   74.76094055   69.51121521   57.37756348   97.80252075
     99.40531921  112.53370667  130.19979858  148.98825073  107.54998779
     96.45822144   53.4659996    37.10967255   32.7314682    28.58465767
     14.98313427    8.48437881    6.36657619    5.71120358    3.36257386]
  [  23.8848877    28.83255196   31.44088936   39.28152847   53.20536423
     62.94708252   82.9467392    78.57965088   57.5449295    53.00551605
     53.05452728   58.59263611   42.36648941   50.00153732   98.83109283
    108.10786438  120.09384155  106.36047363   97.85395813   98.98187256
    127.3739624    80.01171875   45.42490005   40.44134903   39.63466644
     27.26070404   13.84435844    9.49979973    5.87198687    4.35484314]
  [  32.40687561   43.72882843   42.99148941   58.60381317   73.90912628
     70.76618958   81.97972107   67.19429016   40.3654747    36.19136047
     42.86167145   48.11315536   61.81523132   89.37221527  131.33099365
    130.08872986  161.70274353  123.66903687  105.64864349   90.46429443
     75.36128235   56.42850494   45.50717926   54.66439819   47.49055862
     41.03205872   33.25825882   25.42322922   13.61657143    8.71987724]
  [  43.88284302   56.1951828    56.03739166   71.01376343   82.01865387
     58.73814392   45.57513428   34.0021553    29.03989792   34.26357269
     51.95457458   85.48791504  113.65590668  121.20000458  152.26501465
    122.58648682  147.99058533   95.32862854   68.63296509   48.84579468
     52.23950577   35.83456802   19.57123566   30.46207809   56.70370483
     61.32459259   45.59409332   40.01547241   31.05666924   17.55149841]
  [  64.57681274   53.73843384   61.21253967   53.78304291   45.05437088
     40.00626755   24.25611115   18.12685394   36.25395966   48.68135071
     61.62170029  126.84129333  122.94155884   73.26490021  107.58103943
    103.00952148  107.86577606   83.10978699   71.80714417   30.18749619
     45.49108887   24.78409958   22.72003174   23.46670914   28.32693291
     38.0867691    48.63722992   54.59058762   41.83346176   25.50140762]
  [  58.92792511   38.82582855   27.78372574   19.36591911   24.84260559
     27.1991806    21.28651428   22.97083664   49.04473114   82.04023743
     99.39442444  147.70066833  148.47434998   77.59602356  131.71847534
    134.8193512    76.17941284   89.22505188   55.28446579   32.30503845
     45.40515137   18.71821594   15.88380909   16.34761238   12.24054718
     15.26989937   20.28105927   27.02042198   26.60529327   24.70442581]
  [  20.64253807   11.56664467   15.41681671   14.35499001   16.37995529
     15.45108986   18.79897118   17.1397934    39.81903458  103.99052429
    169.33856201  240.32829285  193.15710449  171.08969116  174.88760376
    135.57946777   60.07051086  100.17845154   59.42309952   41.82769775
     42.23598099   21.28861046   15.24238014   12.95484829   12.74480915
     16.58581543   22.25796127   22.15008926   13.50793076   10.06123829]
  [  12.25784016   18.22787476   18.90585136   13.06529522   12.32592773
     12.14874744   15.29203796   10.27048492   30.85258102   95.57675934
     78.07905579  133.1736145   233.03341675  265.17132568  254.25457764
    143.09393311   72.55413818   96.28755188   85.16819763   55.58297729
     39.92942047   22.08545303   15.01264      10.49587822   10.49056435
     11.30630589    8.20960236   11.45411396   15.90427589   10.2773037 ]
  [  15.46028709   22.8337822    14.23488998    8.08880901    9.63381958
     10.85446739   12.08478737   10.89756012   24.11711311   59.775383
     40.07528687   54.23450851  126.96957397  177.54508972  181.17320251
    131.85987854  113.82424927   94.39466095  101.8812561    68.80290222
     47.09579086   26.21854782   14.34534359   10.64760208   10.432024
      7.93575144    6.12837315    4.89411116    7.11410427    7.29241514]
  [  18.36441803   17.83355713   13.44521713   10.08459091   11.03539181
      9.91426468   10.00385952   10.65867329   14.48249149   26.4181118
     32.2106781    79.1705246   180.64855957  168.05621338  138.61766052
    119.2815094   117.95308685   93.19009399   79.06348419   70.38059235
     48.69833755   19.19200134   12.10754395   11.32983589   11.88951683
      9.86532784    9.08862495    5.35394239    5.78888607    4.88436556]
  [  23.32094765   17.23487473   19.33973694   12.71365833   13.96926498
     14.15538788   13.8437624    15.97000885   18.43057442   19.27611542
     33.15295792   91.51343536  194.79109192  127.67789459   89.21136475
     93.28656769   98.07833099   83.68389893   39.66999435   52.35884476
     61.16949463   21.56866455   14.70232964   11.9698391    10.52364063
     10.12268734    9.04450989    6.45737171    6.11844826    3.315485  ]
  [  21.21501923   21.02568054   23.01258469   18.50439644   19.30807877
     18.42882729   20.52475929   20.34321594   24.98872375   24.61051941
     32.12915039   76.94655609  168.42163086  120.6122818    85.80828094
     82.14523315   77.80343628   93.95788574   44.42737579   41.62348175
     58.21009827   28.92624855   19.01431847   14.96493435   13.26146126
      8.46161842    8.47590065   13.7780838    13.8588829     9.17165756]
  [  20.36188126   23.21292496   20.44061279   18.9383049    14.40534019
     10.28686619   14.75067997   17.37759399   20.64077759   19.19107819
     22.46326828   50.94835663  137.35231018  137.5605011   110.46740723
    116.71665955  125.47678375  127.11965179   59.7733078    38.12215424
     45.57209015   27.78456116   21.71836853   17.16754913   16.80397224
     10.68183899   11.18337631   20.78020096   21.17416954   12.80300045]
  [  24.28636551   16.67528152   13.44419384   11.51244164    8.58687496
      8.52274132   12.03186226   15.30235386   14.16750336   15.19782639
     17.84117699   34.35378265   83.87304688   92.9213028    88.23625183
    110.84188843   81.92664337   93.53409576   55.79325104   26.9896431
     16.72430801   13.69436169   14.19398212   11.08281517   11.22804642
      9.05599117    7.7480526    12.15108204   15.49998856   10.67177582]]]
Current loss value: [[[  36.84698486   25.31944656   19.05295372   26.72929001   42.29379272
     42.4466095    36.8651123    25.77234459   31.87740707   43.05461121
     47.14723969   48.08355713   85.19512177   74.53987122   90.32463837
     52.39159012   59.66118622   64.09477234   35.54707336   19.38749695
     26.45584297   29.91149139   31.43980217   29.77198219   24.52454376
     25.90310478   28.49525833   26.08754349   22.75306129   19.04619026]
  [  22.21642303   20.12755775   14.17131519   17.12739944   22.81347847
     16.16996193   11.96669006   14.62566471   21.61488914   29.53083038
     34.73329544   46.74581909   58.82113266   44.07838821   41.14895248
     40.42720032   86.28344727   69.63314056   23.93707848   14.28123856
     15.62097168   15.23616982   14.34072685   18.44782257   14.81083012
     15.40630436   17.61517525   17.93347931   15.7487011     9.74167347]
  [  19.57742691   24.88094711   21.20959854   17.02429199   16.04206276
     11.64803505   10.16344833   12.62602901   16.65310097   25.14056969
     29.60168839   37.40457916   39.83079147   33.47225952   40.24455261
     61.45488358   66.42613983   37.97806549   19.88283157   28.19946861
     17.68590546   13.24964905   11.38617039   16.90208817   11.6660862
      8.5124836     8.11018372    6.87087727    5.87622786    2.94226074]
  [  24.40624619   15.42626762   18.24381447    6.81579018    5.53282499
      5.63473511    8.45338249    8.4103384     8.87650013   17.13197708
     23.67867279   32.10264587   44.59202576   32.94459915   36.64169312
     39.07665253   24.5747242    18.97734261   22.58559418   34.4894104
     12.30844021    7.7691474     9.11991692   14.07856178   10.26850605
      5.20890141    4.51819086    3.01186919    3.99798989    2.35131383]
  [  26.87335777   15.99230289   19.77634048    3.67461252    3.19781733
      6.18075562    8.52385235    6.16398668    8.44408417   24.09635544
     28.84062576   36.3432312    44.44422913   53.32261658   68.31532288
     49.60505676   23.63946724   17.21792221   18.50744629   19.89505196
      7.37253666    7.82778835   10.797122     12.28849411    5.79283428
      5.47257423    6.13826084    3.15261173    3.26059103    1.87902093]
  [  26.45552826   17.74158478   16.85414886    3.78730512    3.2499392
      6.68403816   10.29344177    8.42188072    7.20945787   17.12720108
     25.45149994   27.18572235   32.21635437   61.92987061   95.58205414
     68.22597504   26.26948357   12.86272621   14.63485718   13.04049397
      8.16737556    8.45832062    7.9544158     9.22803879    7.23541212
      6.62557316    5.65645504    3.79809713    3.68650341    2.06147599]
  [  25.8517971    17.26992798   12.12336731    5.14541531    7.16089058
     11.14670753   12.56089401   10.79888725    9.35702038   15.82734203
     20.5882206    34.31065369   54.4598465    73.07779694   73.4697876
     50.30710602   25.76651001   17.26823044   18.06002808   15.44981956
     10.02947426    8.83589935    8.91701508    9.05738354    7.94933319
      6.5726099     4.43359947    3.49646997    3.06789565    1.83218074]
  [  25.37178421   13.54181576   10.49773502    7.04174232   13.28252792
     13.06725311    9.067523      8.00564098    9.4465065    17.76525879
     22.64673233   33.83179474   64.70851898   79.98925781   70.03173065
     44.53315735   29.77414322   23.86408806   14.68952751   13.13087177
     11.11766434   11.78374577   12.24998283   11.04081535    6.25272083
      6.22565126    6.83769417    5.50280142    5.01274967    2.64517593]
  [  24.53227234   18.75757217   13.19798946    6.11932945   11.43343353
      9.31463909    4.99764633    6.56747627    9.12177849   14.71486187
     23.46367073   34.51398849   66.44445038   95.44490814   91.27098083
     53.69154358   31.95396042   16.58475876   11.88929558   13.57168579
     20.56903458   24.88650894   14.85542774    9.25181198    5.18660927
      6.56328392    6.55052662    3.88092685    4.33286667    3.75772047]
  [  30.24384308   28.41597939   30.39845276    8.5997715     8.89387417
      6.86919117    5.81216621    7.89536762    9.59887505   18.69369698
     24.69238281   36.85797119   58.10764313   82.20747375   87.02401733
     50.94883728   32.12088013   19.54047394   15.52814102   20.06283569
     32.51378632   30.65533066   13.7529583     7.76801252    7.33967113
      7.19772625    4.89906979    3.26389647    4.22839546    3.49560356]
  [  28.34803391   21.94883537   28.91997147   10.76468468    7.13177299
      8.67141533   12.28576565   15.47183514   18.61813164   27.48226357
     24.83708954   31.96836472   43.7817955    54.18900299   65.69287872
     42.41088104   27.03790665   18.83018875   17.08436584   22.90012741
     31.19622421   31.11083412   16.33236122   12.39691544    8.6929493
      3.90506887    1.99953854    2.80636644    4.92864609    3.88765454]
  [  22.45912552   17.92282867   20.95874023    9.88591957    6.28069115
      9.02432346   18.15258598   23.93291473   19.27668571   15.97152328
     15.61698723   17.87669373   25.29166985   34.23241425   52.69477844
     46.93331146   29.00650024   22.22669792   27.63790321   22.48548317
     21.26208878   21.70257187   21.99739647   24.43920898   17.40029526
      7.02110052    2.49624777    2.39991283    5.014925      3.82599163]
  [  18.43977356   16.39016533   14.42775345    5.85423756    5.9852705
      6.19780207   11.73160362   19.43947983   19.90852737   12.40694714
     13.27849865   17.49628448   22.2340641    26.68162155   49.06315231
     38.82772064   23.60436249   22.04231262   30.39455986   20.49438858
     20.21575165   24.99136353   37.62200928   39.53920364   25.60078239
     10.50090027    3.13724709    3.3449297     5.14494038    4.5373311 ]
  [  17.40605354   12.18313026    9.03986168    5.21709347    7.51325178
      9.10673523    9.75004768    8.64521694   12.10320187   10.93111706
     10.19101048   12.98019409   17.95272446   33.69387054   65.46780396
     29.09403801   18.15204239   20.86292267   29.81663513   24.57368469
     20.67206001   20.21802139   29.35870743   26.54339218   12.58208466
      7.10161877    4.06659985    4.23154736    5.71033764    4.80606461]
  [  17.83746338   12.84800339    8.1638298     6.63124752   10.76703644
     11.45411873    7.76015615    7.95398855   10.78273106    8.27191067
      6.82434797    9.52967834   16.6133461    50.29860687   79.9420929
     42.0272522    26.55464554   27.79265594   30.02518082   24.32280731
     20.0477066    13.52071571   15.44428253   13.95771122    9.93310738
      7.89379883    4.19698668    4.78543758    6.63001633    5.06693554]
  [  15.87668419   12.40820312    9.14640331    7.68857956   10.15717316
     11.66932297    6.36829615    7.34377575    7.74601841    6.33887291
      7.36724186   16.17697906   29.36457253   52.00777817   60.42685699
     33.48775482   29.77257729   26.91317368   23.27618408   22.38869476
     24.21271706   19.39748764   14.68226147   11.61074066    7.50149012
      5.68187237    4.44064522    4.98696613    6.45942307    5.17210197]
  [  12.92306232    7.95920944    6.06601667   10.36039352   12.97352886
     16.72977829    8.81846237   10.36949921   11.23659515    9.59153461
     12.94584274   27.84108162   57.81919098   84.53384399  158.97982788
     96.08143616   39.97628784   36.37443542   17.84990311   18.42169571
     20.56800461   18.79102516   12.70943356    8.20521832    9.50011921
      8.5895071     6.60711384    5.65675545    7.18488026    6.09510231]
  [  13.41681671    8.2195797     6.74190235    9.44470978   14.1685257
     19.90387344   10.35804081   10.98664856   16.0337944    10.04139328
     13.97473335   40.07172394   75.31188202  157.07867432  221.30093384
    141.07743835   63.88210297   41.61660767   17.59001923    9.89108372
     12.46729946   12.50958061    8.70855522    6.99825382    9.87698174
      8.36843109    7.00560474    7.17883968    8.74594307    6.30434465]
  [  14.82688713    8.23512077    7.46528912    6.24091816   10.63988495
     16.17170715    9.6863308     7.05316448    9.52746391    6.90135098
     12.93098068   49.90251923   59.80786896  103.92541504  112.2303009
    123.23220062   67.03277588   42.96932983   16.46970749    4.6576643
      6.2024827     6.01095867    5.11962032    6.86762714    9.63426685
      8.87859917    7.8537941     8.56534004    9.5058136     5.40066576]
  [  13.32890129    6.97966862    8.82277107    7.36613703    9.64198303
      8.00553703    6.77865744    6.98492098   14.47236919   17.65263748
     17.45125198   46.01140213   69.63754272   76.97796631  115.1215744
    124.47766113   60.82207489   60.35151291   34.93093109   11.67560577
      7.90226078   10.85835361   16.95126343   18.67480087   12.83389568
      8.03400803    5.77185917    6.93891668    7.3060894     5.10761261]
  [  12.36916161    8.90360451   11.29246426   10.47753143   11.32680321
     12.50506592   18.91886902   24.37705612   35.46416473   36.72691727
     27.67515182   44.17044067   59.84904861   91.03405762  191.73422241
    151.20932007   70.83256531   74.16079712   72.44602966   32.93637085
     13.30335331   12.28443527   17.43498993   13.1918335    10.36067772
      9.12405014    5.47388077    9.45927048   11.95039082    8.59208679]
  [  15.34762383   12.47671509   11.64379501    7.6903429    10.93289661
     17.0461731    33.66313934   43.13021088   47.31269073   52.15312958
     45.11149216   66.37770844   77.33177185  108.38127899  277.49377441
    200.55682373   79.69937134   53.88995743   69.45628357   63.19589996
     36.29901123   23.2282753    20.3712883    20.34020424   17.75492287
     13.89548492    9.25919724   14.74749851   14.49842072    8.75744247]
  [  22.3662796    16.6730423    13.62574673   11.75206947   16.37050629
     20.52509308   35.53752899   45.85739517   62.18890762   71.23145294
     58.08383942   83.28904724  110.62566376   95.90843964  144.96954346
    157.08380127   97.85627747   80.44046021   72.07536316   60.6656723
     56.9094162    49.90436172   33.9822464    26.72576141   20.5460453
     11.2945776     8.23498726   12.28023911   12.34329128    7.12724972]
  [  25.51141739   24.42103386   18.26966476   16.24827194   34.27363205
     57.97428513   81.32649231   81.38375854   68.28410339   59.75276184
     57.32948303   74.76094055   69.51121521   57.37756348   97.80252075
     99.40531921  112.53370667  130.19979858  148.98825073  107.54998779
     96.45822144   53.4659996    37.10967255   32.7314682    28.58465767
     14.98313427    8.48437881    6.36657619    5.71120358    3.36257386]
  [  23.8848877    28.83255196   31.44088936   39.28152847   53.20536423
     62.94708252   82.9467392    78.57965088   57.5449295    53.00551605
     53.05452728   58.59263611   42.36648941   50.00153732   98.83109283
    108.10786438  120.09384155  106.36047363   97.85395813   98.98187256
    127.3739624    80.01171875   45.42490005   40.44134903   39.63466644
     27.26070404   13.84435844    9.49979973    5.87198687    4.35484314]
  [  32.40687561   43.72882843   42.99148941   58.60381317   73.90912628
     70.76618958   81.97972107   67.19429016   40.3654747    36.19136047
     42.86167145   48.11315536   61.81523132   89.37221527  131.33099365
    130.08872986  161.70274353  123.66903687  105.64864349   90.46429443
     75.36128235   56.42850494   45.50717926   54.66439819   47.49055862
     41.03205872   33.25825882   25.42322922   13.61657143    8.71987724]
  [  43.88284302   56.1951828    56.03739166   71.01376343   82.01865387
     58.73814392   45.57513428   34.0021553    29.03989792   34.26357269
     51.95457458   85.48791504  113.65590668  121.20000458  152.26501465
    122.58648682  147.99058533   95.32862854   68.63296509   48.84579468
     52.23950577   35.83456802   19.57123566   30.46207809   56.70370483
     61.32459259   45.59409332   40.01547241   31.05666924   17.55149841]
  [  64.57681274   53.73843384   61.21253967   53.78304291   45.05437088
     40.00626755   24.25611115   18.12685394   36.25395966   48.68135071
     61.62170029  126.84129333  122.94155884   73.26490021  107.58103943
    103.00952148  107.86577606   83.10978699   71.80714417   30.18749619
     45.49108887   24.78409958   22.72003174   23.46670914   28.32693291
     38.0867691    48.63722992   54.59058762   41.83346176   25.50140762]
  [  58.92792511   38.82582855   27.78372574   19.36591911   24.84260559
     27.1991806    21.28651428   22.97083664   49.04473114   82.04023743
     99.39442444  147.70066833  148.47434998   77.59602356  131.71847534
    134.8193512    76.17941284   89.22505188   55.28446579   32.30503845
     45.40515137   18.71821594   15.88380909   16.34761238   12.24054718
     15.26989937   20.28105927   27.02042198   26.60529327   24.70442581]
  [  20.64253807   11.56664467   15.41681671   14.35499001   16.37995529
     15.45108986   18.79897118   17.1397934    39.81903458  103.99052429
    169.33856201  240.32829285  193.15710449  171.08969116  174.88760376
    135.57946777   60.07051086  100.17845154   59.42309952   41.82769775
     42.23598099   21.28861046   15.24238014   12.95484829   12.74480915
     16.58581543   22.25796127   22.15008926   13.50793076   10.06123829]
  [  12.25784016   18.22787476   18.90585136   13.06529522   12.32592773
     12.14874744   15.29203796   10.27048492   30.85258102   95.57675934
     78.07905579  133.1736145   233.03341675  265.17132568  254.25457764
    143.09393311   72.55413818   96.28755188   85.16819763   55.58297729
     39.92942047   22.08545303   15.01264      10.49587822   10.49056435
     11.30630589    8.20960236   11.45411396   15.90427589   10.2773037 ]
  [  15.46028709   22.8337822    14.23488998    8.08880901    9.63381958
     10.85446739   12.08478737   10.89756012   24.11711311   59.775383
     40.07528687   54.23450851  126.96957397  177.54508972  181.17320251
    131.85987854  113.82424927   94.39466095  101.8812561    68.80290222
     47.09579086   26.21854782   14.34534359   10.64760208   10.432024
      7.93575144    6.12837315    4.89411116    7.11410427    7.29241514]
  [  18.36441803   17.83355713   13.44521713   10.08459091   11.03539181
      9.91426468   10.00385952   10.65867329   14.48249149   26.4181118
     32.2106781    79.1705246   180.64855957  168.05621338  138.61766052
    119.2815094   117.95308685   93.19009399   79.06348419   70.38059235
     48.69833755   19.19200134   12.10754395   11.32983589   11.88951683
      9.86532784    9.08862495    5.35394239    5.78888607    4.88436556]
  [  23.32094765   17.23487473   19.33973694   12.71365833   13.96926498
     14.15538788   13.8437624    15.97000885   18.43057442   19.27611542
     33.15295792   91.51343536  194.79109192  127.67789459   89.21136475
     93.28656769   98.07833099   83.68389893   39.66999435   52.35884476
     61.16949463   21.56866455   14.70232964   11.9698391    10.52364063
     10.12268734    9.04450989    6.45737171    6.11844826    3.315485  ]
  [  21.21501923   21.02568054   23.01258469   18.50439644   19.30807877
     18.42882729   20.52475929   20.34321594   24.98872375   24.61051941
     32.12915039   76.94655609  168.42163086  120.6122818    85.80828094
     82.14523315   77.80343628   93.95788574   44.42737579   41.62348175
     58.21009827   28.92624855   19.01431847   14.96493435   13.26146126
      8.46161842    8.47590065   13.7780838    13.8588829     9.17165756]
  [  20.36188126   23.21292496   20.44061279   18.9383049    14.40534019
     10.28686619   14.75067997   17.37759399   20.64077759   19.19107819
     22.46326828   50.94835663  137.35231018  137.5605011   110.46740723
    116.71665955  125.47678375  127.11965179   59.7733078    38.12215424
     45.57209015   27.78456116   21.71836853   17.16754913   16.80397224
     10.68183899   11.18337631   20.78020096   21.17416954   12.80300045]
  [  24.28636551   16.67528152   13.44419384   11.51244164    8.58687496
      8.52274132   12.03186226   15.30235386   14.16750336   15.19782639
     17.84117699   34.35378265   83.87304688   92.9213028    88.23625183
    110.84188843   81.92664337   93.53409576   55.79325104   26.9896431
     16.72430801   13.69436169   14.19398212   11.08281517   11.22804642
      9.05599117    7.7480526    12.15108204   15.49998856   10.67177582]]]
Current loss value: [[[  36.84698486   25.31944656   19.05295372   26.72929001   42.29379272
     42.4466095    36.8651123    25.77234459   31.87740707   43.05461121
     47.14723969   48.08355713   85.19512177   74.53987122   90.32463837
     52.39159012   59.66118622   64.09477234   35.54707336   19.38749695
     26.45584297   29.91149139   31.43980217   29.77198219   24.52454376
     25.90310478   28.49525833   26.08754349   22.75306129   19.04619026]
  [  22.21642303   20.12755775   14.17131519   17.12739944   22.81347847
     16.16996193   11.96669006   14.62566471   21.61488914   29.53083038
     34.73329544   46.74581909   58.82113266   44.07838821   41.14895248
     40.42720032   86.28344727   69.63314056   23.93707848   14.28123856
     15.62097168   15.23616982   14.34072685   18.44782257   14.81083012
     15.40630436   17.61517525   17.93347931   15.7487011     9.74167347]
  [  19.57742691   24.88094711   21.20959854   17.02429199   16.04206276
     11.64803505   10.16344833   12.62602901   16.65310097   25.14056969
     29.60168839   37.40457916   39.83079147   33.47225952   40.24455261
     61.45488358   66.42613983   37.97806549   19.88283157   28.19946861
     17.68590546   13.24964905   11.38617039   16.90208817   11.6660862
      8.5124836     8.11018372    6.87087727    5.87622786    2.94226074]
  [  24.40624619   15.42626762   18.24381447    6.81579018    5.53282499
      5.63473511    8.45338249    8.4103384     8.87650013   17.13197708
     23.67867279   32.10264587   44.59202576   32.94459915   36.64169312
     39.07665253   24.5747242    18.97734261   22.58559418   34.4894104
     12.30844021    7.7691474     9.11991692   14.07856178   10.26850605
      5.20890141    4.51819086    3.01186919    3.99798989    2.35131383]
  [  26.87335777   15.99230289   19.77634048    3.67461252    3.19781733
      6.18075562    8.52385235    6.16398668    8.44408417   24.09635544
     28.84062576   36.3432312    44.44422913   53.32261658   68.31532288
     49.60505676   23.63946724   17.21792221   18.50744629   19.89505196
      7.37253666    7.82778835   10.797122     12.28849411    5.79283428
      5.47257423    6.13826084    3.15261173    3.26059103    1.87902093]
  [  26.45552826   17.74158478   16.85414886    3.78730512    3.2499392
      6.68403816   10.29344177    8.42188072    7.20945787   17.12720108
     25.45149994   27.18572235   32.21635437   61.92987061   95.58205414
     68.22597504   26.26948357   12.86272621   14.63485718   13.04049397
      8.16737556    8.45832062    7.9544158     9.22803879    7.23541212
      6.62557316    5.65645504    3.79809713    3.68650341    2.06147599]
  [  25.8517971    17.26992798   12.12336731    5.14541531    7.16089058
     11.14670753   12.56089401   10.79888725    9.35702038   15.82734203
     20.5882206    34.31065369   54.4598465    73.07779694   73.4697876
     50.30710602   25.76651001   17.26823044   18.06002808   15.44981956
     10.02947426    8.83589935    8.91701508    9.05738354    7.94933319
      6.5726099     4.43359947    3.49646997    3.06789565    1.83218074]
  [  25.37178421   13.54181576   10.49773502    7.04174232   13.28252792
     13.06725311    9.067523      8.00564098    9.4465065    17.76525879
     22.64673233   33.83179474   64.70851898   79.98925781   70.03173065
     44.53315735   29.77414322   23.86408806   14.68952751   13.13087177
     11.11766434   11.78374577   12.24998283   11.04081535    6.25272083
      6.22565126    6.83769417    5.50280142    5.01274967    2.64517593]
  [  24.53227234   18.75757217   13.19798946    6.11932945   11.43343353
      9.31463909    4.99764633    6.56747627    9.12177849   14.71486187
     23.46367073   34.51398849   66.44445038   95.44490814   91.27098083
     53.69154358   31.95396042   16.58475876   11.88929558   13.57168579
     20.56903458   24.88650894   14.85542774    9.25181198    5.18660927
      6.56328392    6.55052662    3.88092685    4.33286667    3.75772047]
  [  30.24384308   28.41597939   30.39845276    8.5997715     8.89387417
      6.86919117    5.81216621    7.89536762    9.59887505   18.69369698
     24.69238281   36.85797119   58.10764313   82.20747375   87.02401733
     50.94883728   32.12088013   19.54047394   15.52814102   20.06283569
     32.51378632   30.65533066   13.7529583     7.76801252    7.33967113
      7.19772625    4.89906979    3.26389647    4.22839546    3.49560356]
  [  28.34803391   21.94883537   28.91997147   10.76468468    7.13177299
      8.67141533   12.28576565   15.47183514   18.61813164   27.48226357
     24.83708954   31.96836472   43.7817955    54.18900299   65.69287872
     42.41088104   27.03790665   18.83018875   17.08436584   22.90012741
     31.19622421   31.11083412   16.33236122   12.39691544    8.6929493
      3.90506887    1.99953854    2.80636644    4.92864609    3.88765454]
  [  22.45912552   17.92282867   20.95874023    9.88591957    6.28069115
      9.02432346   18.15258598   23.93291473   19.27668571   15.97152328
     15.61698723   17.87669373   25.29166985   34.23241425   52.69477844
     46.93331146   29.00650024   22.22669792   27.63790321   22.48548317
     21.26208878   21.70257187   21.99739647   24.43920898   17.40029526
      7.02110052    2.49624777    2.39991283    5.014925      3.82599163]
  [  18.43977356   16.39016533   14.42775345    5.85423756    5.9852705
      6.19780207   11.73160362   19.43947983   19.90852737   12.40694714
     13.27849865   17.49628448   22.2340641    26.68162155   49.06315231
     38.82772064   23.60436249   22.04231262   30.39455986   20.49438858
     20.21575165   24.99136353   37.62200928   39.53920364   25.60078239
     10.50090027    3.13724709    3.3449297     5.14494038    4.5373311 ]
  [  17.40605354   12.18313026    9.03986168    5.21709347    7.51325178
      9.10673523    9.75004768    8.64521694   12.10320187   10.93111706
     10.19101048   12.98019409   17.95272446   33.69387054   65.46780396
     29.09403801   18.15204239   20.86292267   29.81663513   24.57368469
     20.67206001   20.21802139   29.35870743   26.54339218   12.58208466
      7.10161877    4.06659985    4.23154736    5.71033764    4.80606461]
  [  17.83746338   12.84800339    8.1638298     6.63124752   10.76703644
     11.45411873    7.76015615    7.95398855   10.78273106    8.27191067
      6.82434797    9.52967834   16.6133461    50.29860687   79.9420929
     42.0272522    26.55464554   27.79265594   30.02518082   24.32280731
     20.0477066    13.52071571   15.44428253   13.95771122    9.93310738
      7.89379883    4.19698668    4.78543758    6.63001633    5.06693554]
  [  15.87668419   12.40820312    9.14640331    7.68857956   10.15717316
     11.66932297    6.36829615    7.34377575    7.74601841    6.33887291
      7.36724186   16.17697906   29.36457253   52.00777817   60.42685699
     33.48775482   29.77257729   26.91317368   23.27618408   22.38869476
     24.21271706   19.39748764   14.68226147   11.61074066    7.50149012
      5.68187237    4.44064522    4.98696613    6.45942307    5.17210197]
  [  12.92306232    7.95920944    6.06601667   10.36039352   12.97352886
     16.72977829    8.81846237   10.36949921   11.23659515    9.59153461
     12.94584274   27.84108162   57.81919098   84.53384399  158.97982788
     96.08143616   39.97628784   36.37443542   17.84990311   18.42169571
     20.56800461   18.79102516   12.70943356    8.20521832    9.50011921
      8.5895071     6.60711384    5.65675545    7.18488026    6.09510231]
  [  13.41681671    8.2195797     6.74190235    9.44470978   14.1685257
     19.90387344   10.35804081   10.98664856   16.0337944    10.04139328
     13.97473335   40.07172394   75.31188202  157.07867432  221.30093384
    141.07743835   63.88210297   41.61660767   17.59001923    9.89108372
     12.46729946   12.50958061    8.70855522    6.99825382    9.87698174
      8.36843109    7.00560474    7.17883968    8.74594307    6.30434465]
  [  14.82688713    8.23512077    7.46528912    6.24091816   10.63988495
     16.17170715    9.6863308     7.05316448    9.52746391    6.90135098
     12.93098068   49.90251923   59.80786896  103.92541504  112.2303009
    123.23220062   67.03277588   42.96932983   16.46970749    4.6576643
      6.2024827     6.01095867    5.11962032    6.86762714    9.63426685
      8.87859917    7.8537941     8.56534004    9.5058136     5.40066576]
  [  13.32890129    6.97966862    8.82277107    7.36613703    9.64198303
      8.00553703    6.77865744    6.98492098   14.47236919   17.65263748
     17.45125198   46.01140213   69.63754272   76.97796631  115.1215744
    124.47766113   60.82207489   60.35151291   34.93093109   11.67560577
      7.90226078   10.85835361   16.95126343   18.67480087   12.83389568
      8.03400803    5.77185917    6.93891668    7.3060894     5.10761261]
  [  12.36916161    8.90360451   11.29246426   10.47753143   11.32680321
     12.50506592   18.91886902   24.37705612   35.46416473   36.72691727
     27.67515182   44.17044067   59.84904861   91.03405762  191.73422241
    151.20932007   70.83256531   74.16079712   72.44602966   32.93637085
     13.30335331   12.28443527   17.43498993   13.1918335    10.36067772
      9.12405014    5.47388077    9.45927048   11.95039082    8.59208679]
  [  15.34762383   12.47671509   11.64379501    7.6903429    10.93289661
     17.0461731    33.66313934   43.13021088   47.31269073   52.15312958
     45.11149216   66.37770844   77.33177185  108.38127899  277.49377441
    200.55682373   79.69937134   53.88995743   69.45628357   63.19589996
     36.29901123   23.2282753    20.3712883    20.34020424   17.75492287
     13.89548492    9.25919724   14.74749851   14.49842072    8.75744247]
  [  22.3662796    16.6730423    13.62574673   11.75206947   16.37050629
     20.52509308   35.53752899   45.85739517   62.18890762   71.23145294
     58.08383942   83.28904724  110.62566376   95.90843964  144.96954346
    157.08380127   97.85627747   80.44046021   72.07536316   60.6656723
     56.9094162    49.90436172   33.9822464    26.72576141   20.5460453
     11.2945776     8.23498726   12.28023911   12.34329128    7.12724972]
  [  25.51141739   24.42103386   18.26966476   16.24827194   34.27363205
     57.97428513   81.32649231   81.38375854   68.28410339   59.75276184
     57.32948303   74.76094055   69.51121521   57.37756348   97.80252075
     99.40531921  112.53370667  130.19979858  148.98825073  107.54998779
     96.45822144   53.4659996    37.10967255   32.7314682    28.58465767
     14.98313427    8.48437881    6.36657619    5.71120358    3.36257386]
  [  23.8848877    28.83255196   31.44088936   39.28152847   53.20536423
     62.94708252   82.9467392    78.57965088   57.5449295    53.00551605
     53.05452728   58.59263611   42.36648941   50.00153732   98.83109283
    108.10786438  120.09384155  106.36047363   97.85395813   98.98187256
    127.3739624    80.01171875   45.42490005   40.44134903   39.63466644
     27.26070404   13.84435844    9.49979973    5.87198687    4.35484314]
  [  32.40687561   43.72882843   42.99148941   58.60381317   73.90912628
     70.76618958   81.97972107   67.19429016   40.3654747    36.19136047
     42.86167145   48.11315536   61.81523132   89.37221527  131.33099365
    130.08872986  161.70274353  123.66903687  105.64864349   90.46429443
     75.36128235   56.42850494   45.50717926   54.66439819   47.49055862
     41.03205872   33.25825882   25.42322922   13.61657143    8.71987724]
  [  43.88284302   56.1951828    56.03739166   71.01376343   82.01865387
     58.73814392   45.57513428   34.0021553    29.03989792   34.26357269
     51.95457458   85.48791504  113.65590668  121.20000458  152.26501465
    122.58648682  147.99058533   95.32862854   68.63296509   48.84579468
     52.23950577   35.83456802   19.57123566   30.46207809   56.70370483
     61.32459259   45.59409332   40.01547241   31.05666924   17.55149841]
  [  64.57681274   53.73843384   61.21253967   53.78304291   45.05437088
     40.00626755   24.25611115   18.12685394   36.25395966   48.68135071
     61.62170029  126.84129333  122.94155884   73.26490021  107.58103943
    103.00952148  107.86577606   83.10978699   71.80714417   30.18749619
     45.49108887   24.78409958   22.72003174   23.46670914   28.32693291
     38.0867691    48.63722992   54.59058762   41.83346176   25.50140762]
  [  58.92792511   38.82582855   27.78372574   19.36591911   24.84260559
     27.1991806    21.28651428   22.97083664   49.04473114   82.04023743
     99.39442444  147.70066833  148.47434998   77.59602356  131.71847534
    134.8193512    76.17941284   89.22505188   55.28446579   32.30503845
     45.40515137   18.71821594   15.88380909   16.34761238   12.24054718
     15.26989937   20.28105927   27.02042198   26.60529327   24.70442581]
  [  20.64253807   11.56664467   15.41681671   14.35499001   16.37995529
     15.45108986   18.79897118   17.1397934    39.81903458  103.99052429
    169.33856201  240.32829285  193.15710449  171.08969116  174.88760376
    135.57946777   60.07051086  100.17845154   59.42309952   41.82769775
     42.23598099   21.28861046   15.24238014   12.95484829   12.74480915
     16.58581543   22.25796127   22.15008926   13.50793076   10.06123829]
  [  12.25784016   18.22787476   18.90585136   13.06529522   12.32592773
     12.14874744   15.29203796   10.27048492   30.85258102   95.57675934
     78.07905579  133.1736145   233.03341675  265.17132568  254.25457764
    143.09393311   72.55413818   96.28755188   85.16819763   55.58297729
     39.92942047   22.08545303   15.01264      10.49587822   10.49056435
     11.30630589    8.20960236   11.45411396   15.90427589   10.2773037 ]
  [  15.46028709   22.8337822    14.23488998    8.08880901    9.63381958
     10.85446739   12.08478737   10.89756012   24.11711311   59.775383
     40.07528687   54.23450851  126.96957397  177.54508972  181.17320251
    131.85987854  113.82424927   94.39466095  101.8812561    68.80290222
     47.09579086   26.21854782   14.34534359   10.64760208   10.432024
      7.93575144    6.12837315    4.89411116    7.11410427    7.29241514]
  [  18.36441803   17.83355713   13.44521713   10.08459091   11.03539181
      9.91426468   10.00385952   10.65867329   14.48249149   26.4181118
     32.2106781    79.1705246   180.64855957  168.05621338  138.61766052
    119.2815094   117.95308685   93.19009399   79.06348419   70.38059235
     48.69833755   19.19200134   12.10754395   11.32983589   11.88951683
      9.86532784    9.08862495    5.35394239    5.78888607    4.88436556]
  [  23.32094765   17.23487473   19.33973694   12.71365833   13.96926498
     14.15538788   13.8437624    15.97000885   18.43057442   19.27611542
     33.15295792   91.51343536  194.79109192  127.67789459   89.21136475
     93.28656769   98.07833099   83.68389893   39.66999435   52.35884476
     61.16949463   21.56866455   14.70232964   11.9698391    10.52364063
     10.12268734    9.04450989    6.45737171    6.11844826    3.315485  ]
  [  21.21501923   21.02568054   23.01258469   18.50439644   19.30807877
     18.42882729   20.52475929   20.34321594   24.98872375   24.61051941
     32.12915039   76.94655609  168.42163086  120.6122818    85.80828094
     82.14523315   77.80343628   93.95788574   44.42737579   41.62348175
     58.21009827   28.92624855   19.01431847   14.96493435   13.26146126
      8.46161842    8.47590065   13.7780838    13.8588829     9.17165756]
  [  20.36188126   23.21292496   20.44061279   18.9383049    14.40534019
     10.28686619   14.75067997   17.37759399   20.64077759   19.19107819
     22.46326828   50.94835663  137.35231018  137.5605011   110.46740723
    116.71665955  125.47678375  127.11965179   59.7733078    38.12215424
     45.57209015   27.78456116   21.71836853   17.16754913   16.80397224
     10.68183899   11.18337631   20.78020096   21.17416954   12.80300045]
  [  24.28636551   16.67528152   13.44419384   11.51244164    8.58687496
      8.52274132   12.03186226   15.30235386   14.16750336   15.19782639
     17.84117699   34.35378265   83.87304688   92.9213028    88.23625183
    110.84188843   81.92664337   93.53409576   55.79325104   26.9896431
     16.72430801   13.69436169   14.19398212   11.08281517   11.22804642
      9.05599117    7.7480526    12.15108204   15.49998856   10.67177582]]]
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-36-57e5dd99086c> in <module>()
      1 iterations = 10
----> 2 x = solve_image(evaluator, iterations, x)

<ipython-input-34-050382ea2c1b> in solve_image(eval_obj, niter, x)
     18     for i in range(niter):
     19         x, min_val, info = fmin_l_bfgs_b(eval_obj.loss, x.flatten(),
---> 20                                          fprime=eval_obj.grads, maxfun=20)
     21         x = np.clip(x, -127,127)
     22         print('Current loss value:', min_val)

~/miniconda3/envs/FAI3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py in fmin_l_bfgs_b(func, x0, fprime, args, approx_grad, bounds, m, factr, pgtol, epsilon, iprint, maxfun, maxiter, disp, callback, maxls)
    191 
    192     res = _minimize_lbfgsb(fun, x0, args=args, jac=jac, bounds=bounds,
--> 193                            **opts)
    194     d = {'grad': res['jac'],
    195          'task': res['message'],

~/miniconda3/envs/FAI3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py in _minimize_lbfgsb(fun, x0, args, jac, bounds, disp, maxcor, ftol, gtol, eps, maxfun, maxiter, iprint, callback, maxls, **unknown_options)
    260         raise ValueError('length of x0 != length of bounds')
    261     # unbounded variables must use None, not +-inf, for optimizer to work properly
--> 262     bounds = [(None if l == -np.inf else l, None if u == np.inf else u) for l, u in bounds]
    263 
    264     if disp is not None:

~/miniconda3/envs/FAI3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py in <listcomp>(.0)
    260         raise ValueError('length of x0 != length of bounds')
    261     # unbounded variables must use None, not +-inf, for optimizer to work properly
--> 262     bounds = [(None if l == -np.inf else l, None if u == np.inf else u) for l, u in bounds]
    263 
    264     if disp is not None:

KeyboardInterrupt: 

In [41]:
Image.open(path + 'results/res_at_iteration_1.png')


Out[41]:

In [ ]:
# Looking at result for earlier Conv block (4):
layer = model.get_layer('block4_conv1').output
layer_model = Model(model.input, layer)
targ = K.variable(layer_model.predict(img_arr))

loss = metrics.mse(layer, targ)
grads = K.gradients(loss, model.input)
fn = K.function([model.input], [loss]+grads)
evaluator = Evaluator(fn, shp)

x = solve_image(evaluator, iterations, x)

In [ ]:
Image.open(path + 'results/res_at_iteration_9.png')

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: