lesson19 正则化

https://www.bilibili.com/video/av22530538/?p=19

#coding:uft-8
#lesson19 正则化
#正则化缓解过拟合
#正则化在损失函数中引入模型复杂度指标,利用给W加全值,强化了训练数据在噪声(一般不正则化b)

#loss = loss(y与y_)+REGULARIZER*loss(w)
# loss(y与y_)--->模型中所有参数的损失函数 如:交叉熵,均方误差
#REGULARIZER  --->y用超参数REGULARIZER给出参数w在总loss中的比例,即正则化的权重
#w--->需要正则化的权重

#loss(w) = tf.contrib.layer.l1_regularizer(REGULARIZER)(w)   loss(l1)(w) = w(i)求和
#loss(w) = tf.contrib.layer.l2_regularizer(REGULARIZER)(w)   loss(l2)(w) = w(i)平方求和

#tf.add_to_clooection('losses',tf.contrib.layers.l2_regularizer(regularizer))(w)
#                              把内容加到集合对应的位置做加法

#loss = cem + tf.add_n(tf.get_collection('losses'))
#数据X[x0,x1]为正态分布随机点
#标注Y_当x0^2 + x1^2 <2时y_ = 1(红), 其余y_ = 0 (蓝)

#import  matplotlib.pyplot as plt      sudo pip install 待安装的模块名

#plt.scatter(x坐标,y坐标,c=“颜色”)
#plt.show()

#xx, yy = np.mgrid[起:止:步长,起:止:步长]       grid = np.c_[xx.ravel(),yy.ravel()]
#                                                       组成矩阵    拉直

#probs = sess.run(y, feed_dict={x:grid})
#probs = probs.reshape(xx.shape)

#plt.contour(x轴坐标值,y轴坐标值,该点的高度,levels=【等高线的高度】)
#plt.show()
 

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
#import generateds
#import forward

STEPS = 40000
BATCH_SIZE = 30
LEARNING_RATE_BASE = 0.001
LEARNING_RATE_DELAY = 0.999
REAULARIZER = 0.01

seed = 2

#基于seed产生随机数
rdm = np.random.RandomState(seed)
#随机数返回300行2列的矩阵,表示300组坐标点(x0.x1)作文输入数据集
X = rdm.randn(300,2)
#从X这个300行2列的矩阵中取出一行,判断如果两个坐标的平方和小于2,给Y赋值1,其余赋值0
#作为输入数据集的标签(正确答案)
Y_ = [int(x0*x0 + x1*x1 <2) for (x0,x1) in X]
#遍历Y中的每个元素,1赋值‘red’其他赋值‘blue’,这样可视化显示时人可以直观区分
Y_c = [['red' if y else 'blue'] for y in Y_]
#对数据集X和标签Y进行形状整理,第一个元素为-1表示跟随第二列计算,第二个元素表示多少列,
#可见X为两列,Y为1列
X = np.vstack(X).reshape(-1,2)
Y_ = np.vstack(Y_).reshape(-1,1)

plt.scatter(X[:,0], X[:,1], c=np.squeeze(Y_c))
plt.show()


#定义神经网络的输入,参数和输出,定义前向传输过程
def get_weight(shape, regularizer):
    w = tf.Variable(tf.random_normal(shape), dtype=tf.float32)
    tf.add_to_collection('losses',tf.contrib.layers.l2_regularizer(regularizer)(w))
    return w

def get_bias(shape):
    b = tf.Variable(tf.constant(0.01, shape=shape))
    return b


w1 = get_weight([2,11], 0.01)
b1 = get_bias([11])
y1 = tf.nn.relu(tf.matmul(x, w1) + b1)

w2 = get_weight([11,1], 0.01)
b2 = get_bias([1])
y = tf.matmul(y1, w2) + b2 #输出层不过激活



#定义损失函数
loss_mse = tf.reduce_mean(tf.square(y - y_))
loss_total = loss_mse + tf.add_n([tf.get_collection('losses')])


#定义反向传播方法:不包含正则化
train_step = tf.train.AdamOptimizer(0.0001).minimize(loss_mse)


with tf.Session() as sess:
    init_op = tf.global_variables_initializer()
    sess.run(init_op)
    for i in range(STEPS):
        start = (i*BATCH_SIZE)%300
        end = start + BATCH_SIZE
        sess.run(train_step, feed_dict={x: X[start:end], y_: Y_[start:end]})
        if i%2000 == 0:
            loss_v = sess.run(loss_total, feed_dict={x:X, y_:Y_})
            print("After %d steps,loss is :%f",i,loss_v)

    #xx在-3到3之间以步长为0。01,yy在-3到3之间以步长0.01,生成二维网格坐标点
    xx, yy = np.mgrid[-3:3:.01, -3:3:.01]
    #将xx,yy拉直,并合并成一个2列的矩阵,得到一个网格坐标点的集合
    grid = np.c_[xx.ravel(), yy.ravel()]
    #将网格坐标点喂入神经网络,probs为输出
    probs = sess.run(y, feed_dict={x:grid})
    #probs的shape调整成xx的样子
    probs = probs.reshape(xx.shape)
    print(sess.run(w1))
    print(sess.run(b1))
    print(sess.run(w2))
    print(sess.run(b2))

plt.scatter(X[:,0],X[:,1], c=np.squeeze(Y_c))
plt.contour(xx, yy, probs, levels=[.5])
plt.show()

#定义反向传播方法:包含正则化
train_step = tf.train.AdamOptimizer(0.0001).minimize(loss_total)

with tf.Session() as sess:
    init_op = tf.global_variables_initializer()
    sess.run(init_op)
    for i in range(STEPS):
        start = (i*BATCH_SIZE)%300
        end = start + BATCH_SIZE
        sess.run(train_step, feed_dict={x: X[start:end], y_: Y_[start:end]})
        if i%2000 == 0:
            loss_v = sess.run(loss_total, feed_dict={x:X, y_:Y_})
            print("After %d steps,loss is :%f",i,loss_v)


    xx, yy = np.mgrid[-3:3:.01, -3:3:.01]
    grid = np.c_[xx.ravel(), yy.ravel()]
    probs = sess.run(y, feed_dict={x:grid})
    probs = probs.reshape(xx.shape)
    print(sess.run(w1))
    print(sess.run(b1))
    print(sess.run(w2))
    print(sess.run(b2))

plt.scatter(X[:,0],X[:,1], c=np.squeeze(Y_c))
plt.contour(xx, yy, probs, levels=[.5])
plt.show()

[['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['blue'], ['red'], ['blue'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['blue'], ['red'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['blue'], ['blue'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue'], ['red'], ['red'], ['red'], ['red'], ['red'], ['red'], ['blue']]

('After %d steps,loss is :%f', 0, array([13.26558  , 13.129475 , 14.037626 , 13.2365265, 13.658945 ,
       13.318627 , 14.230015 , 12.933054 , 13.6217   , 13.26706  ,
       13.900596 , 13.294263 , 14.003999 , 13.3902025, 13.739179 ,
       12.9037   , 13.781754 , 12.944694 , 12.789869 , 12.6737795,
       12.760209 , 12.672504 , 12.790011 , 12.658839 , 12.762526 ,
       12.703378 , 12.767174 , 12.659891 , 12.77454  , 12.655144 ,
       12.74714  , 12.7097645, 14.205449 , 13.10383  , 14.328429 ,
       12.712533 , 12.757241 , 12.737215 , 12.742084 , 12.680253 ,
       12.754165 , 12.706985 , 12.778175 , 12.71569  , 12.77088  ,
       12.654832 , 12.741099 , 12.680941 , 12.749449 , 12.74565  ,
       12.71029  , 12.666278 , 12.844013 , 12.741726 , 12.74167  ,
       12.694363 , 12.715205 , 12.666502 , 12.771957 , 12.685273 ,
       12.70635  , 12.690441 , 12.709094 , 12.685188 , 12.7228985,
       12.690263 , 12.719982 , 12.768851 , 12.78467  , 12.677087 ,
       12.725612 , 12.687306 , 12.755415 , 12.6937685, 12.696287 ,
       12.678838 , 12.744469 , 12.710011 , 12.739223 , 12.676071 ],
      dtype=float32))
('After %d steps,loss is :%f', 2000, array([5.048612 , 4.912507 , 5.820659 , 5.0195594, 5.4419775, 5.1016593,
       6.013047 , 4.7160864, 5.4047327, 5.050093 , 5.683628 , 5.0772953,
       5.787031 , 5.173235 , 5.522211 , 4.686732 , 5.5647864, 4.7277255,
       4.5729017, 4.456812 , 4.543241 , 4.4555373, 4.5730433, 4.4418716,
       4.545558 , 4.4864097, 4.5502057, 4.4429235, 4.557573 , 4.438176 ,
       4.530172 , 4.492797 , 5.9884815, 4.8868623, 6.1114616, 4.4955654,
       4.5402737, 4.520247 , 4.5251164, 4.463285 , 4.537197 , 4.4900184,
       4.5612073, 4.498722 , 4.553912 , 4.4378643, 4.5241313, 4.463973 ,
       4.5324817, 4.528683 , 4.4933224, 4.449311 , 4.6270456, 4.5247583,
       4.5247016, 4.477395 , 4.498237 , 4.4495344, 4.5549903, 4.4683056,
       4.489383 , 4.4734735, 4.492126 , 4.4682207, 4.505931 , 4.473295 ,
       4.503015 , 4.5518837, 4.5677023, 4.4601192, 4.508644 , 4.470339 ,
       4.538447 , 4.4768014, 4.4793196, 4.46187  , 4.527501 , 4.4930434,
       4.5112095, 4.4528747], dtype=float32))
('After %d steps,loss is :%f', 4000, array([2.5692   , 2.433095 , 3.341247 , 2.5401473, 2.9625654, 2.6222475,
       3.5336351, 2.2366743, 2.9253206, 2.570681 , 3.2042158, 2.5978832,
       3.307619 , 2.6938226, 3.042799 , 2.2073197, 3.0853744, 2.2483134,
       2.0934896, 1.9773998, 2.0638292, 1.9761251, 2.0936313, 1.9624596,
       2.066146 , 2.0069978, 2.0707939, 1.9635116, 2.0781605, 1.9587642,
       2.0507598, 2.013385 , 3.5090694, 2.4074502, 3.6320496, 2.0161533,
       2.0608616, 2.040835 , 2.0457041, 1.983873 , 2.0577853, 2.010606 ,
       2.0817955, 2.0193102, 2.0745003, 1.9584521, 2.0447195, 1.984561 ,
       2.0530696, 2.0492709, 2.01391  , 1.9698986, 2.1476333, 2.0453463,
       2.0452895, 1.9979829, 2.018825 , 1.9701222, 2.0755782, 1.9888937,
       2.009971 , 1.9940615, 2.0127141, 1.9888086, 2.0265186, 1.9938831,
       2.0236027, 2.0724719, 2.0882902, 1.9807072, 2.0292323, 1.990927 ,
       2.0590348, 1.9973891, 1.9999076, 1.9824579, 2.0480888, 2.013631 ,
       2.0243516, 1.9701805], dtype=float32))
('After %d steps,loss is :%f', 6000, array([1.6274581, 1.491353 , 2.3995051, 1.5984054, 2.0208235, 1.6805055,
       2.5918932, 1.2949322, 1.9835787, 1.6289392, 2.2624738, 1.6561412,
       2.3658772, 1.7520807, 2.101057 , 1.2655779, 2.1436324, 1.3065716,
       1.1517477, 1.0356579, 1.1220871, 1.0343832, 1.1518894, 1.0207176,
       1.124404 , 1.0652559, 1.1290519, 1.0217696, 1.1364186, 1.0170223,
       1.1090178, 1.0716431, 2.5673275, 1.4657084, 2.6903076, 1.0744115,
       1.1191196, 1.099093 , 1.1039623, 1.0421311, 1.1160433, 1.0688642,
       1.1400535, 1.0775683, 1.1327583, 1.0167102, 1.1029775, 1.042819 ,
       1.1113276, 1.107529 , 1.0721682, 1.0281566, 1.2058914, 1.1036044,
       1.1035477, 1.0562409, 1.0770832, 1.0283803, 1.1338363, 1.0471518,
       1.068229 , 1.0523195, 1.0709722, 1.0470667, 1.0847768, 1.0521412,
       1.0818608, 1.1307298, 1.1465483, 1.0389652, 1.0874902, 1.049185 ,
       1.117293 , 1.0556471, 1.0581657, 1.0407159, 1.1063468, 1.0718893,
       1.0785373, 1.0273287], dtype=float32))
('After %d steps,loss is :%f', 8000, array([1.1717253 , 1.0356201 , 1.9437723 , 1.1426725 , 1.5650907 ,
       1.2247726 , 2.1361601 , 0.8391994 , 1.5278459 , 1.1732062 ,
       1.806741  , 1.2004082 , 1.9101441 , 1.2963479 , 1.645324  ,
       0.809845  , 1.6878994 , 0.8508387 , 0.6960149 , 0.57992506,
       0.66635424, 0.5786503 , 0.69615656, 0.56498474, 0.66867113,
       0.60952294, 0.673319  , 0.5660367 , 0.68068576, 0.56128937,
       0.653285  , 0.6159102 , 2.1115947 , 1.0099754 , 2.2345748 ,
       0.6186786 , 0.66338676, 0.64336014, 0.6482294 , 0.5863981 ,
       0.6603104 , 0.6131313 , 0.68432057, 0.62183535, 0.67702544,
       0.5609772 , 0.6472446 , 0.5870861 , 0.65559477, 0.65179616,
       0.6164353 , 0.57242376, 0.75015855, 0.64787155, 0.64781475,
       0.60050803, 0.62135035, 0.57264745, 0.6781034 , 0.5914189 ,
       0.61249614, 0.5965866 , 0.61523926, 0.59133375, 0.6290438 ,
       0.59640825, 0.62612796, 0.6749969 , 0.6908154 , 0.5832324 ,
       0.6317574 , 0.5934521 , 0.66156006, 0.59991425, 0.60243285,
       0.58498305, 0.650614  , 0.61615634, 0.6202171 , 0.5715005 ],
      dtype=float32))
('After %d steps,loss is :%f', 10000, array([0.94383574, 0.8077306 , 1.7158828 , 0.914783  , 1.3372011 ,
       0.99688303, 1.9082707 , 0.6113099 , 1.2999563 , 0.9453167 ,
       1.5788515 , 0.9725188 , 1.6822547 , 1.0684583 , 1.4174346 ,
       0.5819555 , 1.4600099 , 0.62294924, 0.46812534, 0.35203552,
       0.43846476, 0.35076082, 0.46826702, 0.33709526, 0.4407816 ,
       0.38163346, 0.4454295 , 0.33814722, 0.45279625, 0.33339986,
       0.4253955 , 0.38802066, 1.8837053 , 0.78208596, 2.0066853 ,
       0.39078912, 0.43549725, 0.41547063, 0.42033988, 0.35850865,
       0.4324209 , 0.3852418 , 0.45643106, 0.39394587, 0.4491359 ,
       0.33308774, 0.4193551 , 0.35919657, 0.42770526, 0.42390665,
       0.3885458 , 0.34453425, 0.522269  , 0.41998202, 0.41992524,
       0.3726185 , 0.3934608 , 0.3447579 , 0.45021385, 0.36352938,
       0.3846066 , 0.3686971 , 0.38734978, 0.36344427, 0.40115434,
       0.36851877, 0.39823842, 0.44710743, 0.4629259 , 0.35534286,
       0.40386784, 0.3655626 , 0.43367058, 0.37202477, 0.3745433 ,
       0.35709357, 0.4227245 , 0.38826683, 0.39050478, 0.34409502],
      dtype=float32))
('After %d steps,loss is :%f', 12000, array([0.8488437 , 0.7127386 , 1.6208907 , 0.81979096, 1.2422091 ,
       0.901891  , 1.8132787 , 0.51631784, 1.2049643 , 0.85032463,
       1.4838594 , 0.87752676, 1.5872626 , 0.9734663 , 1.3224425 ,
       0.48696345, 1.3650179 , 0.5279572 , 0.3731333 , 0.25704348,
       0.34347272, 0.25576878, 0.37327498, 0.2421032 , 0.34578955,
       0.28664142, 0.35043746, 0.24315518, 0.3578042 , 0.2384078 ,
       0.33040345, 0.29302862, 1.7887132 , 0.6870939 , 1.9116933 ,
       0.29579708, 0.3405052 , 0.3204786 , 0.32534784, 0.2635166 ,
       0.33742887, 0.29024976, 0.36143902, 0.29895383, 0.35414386,
       0.2380957 , 0.32436305, 0.26420453, 0.33271322, 0.3289146 ,
       0.29355377, 0.2495422 , 0.427277  , 0.32498997, 0.3249332 ,
       0.27762645, 0.29846877, 0.24976589, 0.3552218 , 0.26853734,
       0.28961456, 0.27370507, 0.29235774, 0.26845223, 0.3061623 ,
       0.27352673, 0.30324638, 0.3521154 , 0.36793387, 0.26035082,
       0.3088758 , 0.27057055, 0.33867854, 0.27703273, 0.27955127,
       0.26210153, 0.32773244, 0.2932748 , 0.29371598, 0.24925487],
      dtype=float32))
('After %d steps,loss is :%f', 14000, array([0.80779994, 0.67169476, 1.5798469 , 0.77874714, 1.2011652 ,
       0.86084723, 1.7722348 , 0.47527403, 1.1639204 , 0.8092809 ,
       1.4428155 , 0.83648294, 1.5462188 , 0.93242246, 1.2813987 ,
       0.44591963, 1.323974  , 0.48691338, 0.3320895 , 0.21599968,
       0.3024289 , 0.21472496, 0.3322312 , 0.2010594 , 0.30474573,
       0.2455976 , 0.30939364, 0.20211138, 0.31676042, 0.197364  ,
       0.28935966, 0.25198483, 1.7476693 , 0.6460501 , 1.8706495 ,
       0.25475326, 0.29946142, 0.27943477, 0.28430405, 0.22247279,
       0.29638505, 0.24920595, 0.32039523, 0.25791   , 0.31310007,
       0.1970519 , 0.28331923, 0.22316074, 0.29166943, 0.2878708 ,
       0.25250995, 0.2084984 , 0.3862332 , 0.2839462 , 0.2838894 ,
       0.23658267, 0.25742498, 0.20872208, 0.31417802, 0.22749355,
       0.24857077, 0.23266125, 0.25131392, 0.22740842, 0.26511848,
       0.23248291, 0.2622026 , 0.31107157, 0.32689005, 0.21930704,
       0.26783198, 0.22952676, 0.29763472, 0.23598893, 0.23850748,
       0.22105771, 0.28668866, 0.252231  , 0.25092983, 0.20777732],
      dtype=float32))
('After %d steps,loss is :%f', 16000, array([0.7869459 , 0.6508407 , 1.5589929 , 0.7578931 , 1.1803112 ,
       0.8399932 , 1.7513808 , 0.45441997, 1.1430664 , 0.7884268 ,
       1.4219615 , 0.8156289 , 1.5253648 , 0.9115684 , 1.2605447 ,
       0.42506558, 1.30312   , 0.46605933, 0.31123546, 0.19514562,
       0.28157485, 0.1938709 , 0.31137714, 0.18020535, 0.28389168,
       0.22474355, 0.2885396 , 0.18125732, 0.29590636, 0.17650995,
       0.2685056 , 0.23113078, 1.7268153 , 0.62519604, 1.8497955 ,
       0.2338992 , 0.27860737, 0.2585807 , 0.26345   , 0.20161873,
       0.275531  , 0.22835189, 0.29954118, 0.23705596, 0.292246  ,
       0.17619784, 0.26246518, 0.20230669, 0.27081537, 0.26701674,
       0.2316559 , 0.18764435, 0.36537915, 0.26309213, 0.26303536,
       0.21572861, 0.23657092, 0.18786803, 0.29332396, 0.2066395 ,
       0.22771671, 0.21180719, 0.23045988, 0.20655437, 0.24426442,
       0.21162885, 0.24134853, 0.29021752, 0.306036  , 0.19845298,
       0.24697794, 0.2086727 , 0.27678066, 0.21513487, 0.21765342,
       0.20020366, 0.2658346 , 0.23137695, 0.22857669, 0.1865068 ],
      dtype=float32))
('After %d steps,loss is :%f', 18000, array([0.772701  , 0.63659585, 1.544748  , 0.7436482 , 1.1660663 ,
       0.8257483 , 1.7371359 , 0.44017512, 1.1288215 , 0.77418196,
       1.4077166 , 0.801384  , 1.5111198 , 0.8973235 , 1.2462997 ,
       0.41082072, 1.2888751 , 0.45181444, 0.29699057, 0.18090075,
       0.26733   , 0.17962603, 0.29713225, 0.16596048, 0.26964682,
       0.21049869, 0.27429473, 0.16701245, 0.28166148, 0.16226508,
       0.25426072, 0.2168859 , 1.7125704 , 0.6109512 , 1.8355505 ,
       0.21965435, 0.26436248, 0.24433586, 0.24920513, 0.18737386,
       0.26128614, 0.21410704, 0.2852963 , 0.2228111 , 0.27800113,
       0.16195297, 0.24822032, 0.18806182, 0.2565705 , 0.25277188,
       0.21741104, 0.17339948, 0.35113427, 0.24884726, 0.24879047,
       0.20148374, 0.22232606, 0.17362316, 0.27907908, 0.19239463,
       0.21347183, 0.19756232, 0.21621501, 0.1923095 , 0.23001955,
       0.19738398, 0.22710367, 0.27597266, 0.29179114, 0.1842081 ,
       0.23273307, 0.19442783, 0.2625358 , 0.20089   , 0.20340854,
       0.18595879, 0.25158972, 0.21713206, 0.21312234, 0.1721774 ],
      dtype=float32))
('After %d steps,loss is :%f', 20000, array([0.7619535 , 0.6258483 , 1.5340004 , 0.7329006 , 1.1553187 ,
       0.8150008 , 1.7263883 , 0.42942756, 1.1180739 , 0.7634344 ,
       1.3969691 , 0.7906364 , 1.5003723 , 0.88657594, 1.2355522 ,
       0.40007317, 1.2781276 , 0.4410669 , 0.28624302, 0.1701532 ,
       0.25658244, 0.16887848, 0.2863847 , 0.15521292, 0.25889927,
       0.19975114, 0.26354718, 0.1562649 , 0.27091393, 0.15151753,
       0.24351317, 0.20613834, 1.7018229 , 0.60020363, 1.824803  ,
       0.2089068 , 0.25361493, 0.23358831, 0.23845758, 0.17662631,
       0.2505386 , 0.20335948, 0.27454874, 0.21206355, 0.26725358,
       0.15120542, 0.23747277, 0.17731427, 0.24582294, 0.24202433,
       0.20666349, 0.16265193, 0.34038672, 0.23809971, 0.23804292,
       0.19073619, 0.2115785 , 0.16287561, 0.26833153, 0.18164708,
       0.20272428, 0.18681477, 0.20546746, 0.18156195, 0.219272  ,
       0.18663643, 0.21635611, 0.2652251 , 0.2810436 , 0.17346054,
       0.22198552, 0.18368028, 0.25178826, 0.19014245, 0.19266099,
       0.17521124, 0.24084218, 0.20638451, 0.20134959, 0.16168758],
      dtype=float32))
('After %d steps,loss is :%f', 22000, array([0.7548768 , 0.6187716 , 1.5269238 , 0.725824  , 1.1482421 ,
       0.8079241 , 1.7193117 , 0.42235088, 1.1109973 , 0.7563577 ,
       1.3898925 , 0.7835598 , 1.4932957 , 0.8794993 , 1.2284756 ,
       0.3929965 , 1.2710509 , 0.43399024, 0.27916637, 0.16307653,
       0.24950576, 0.16180182, 0.27930805, 0.14813626, 0.2518226 ,
       0.19267446, 0.2564705 , 0.14918824, 0.26383728, 0.14444086,
       0.23643652, 0.19906169, 1.6947463 , 0.59312695, 1.8177264 ,
       0.20183012, 0.24653828, 0.22651163, 0.23138091, 0.16954964,
       0.24346192, 0.1962828 , 0.2674721 , 0.20498687, 0.26017693,
       0.14412875, 0.23039609, 0.1702376 , 0.23874627, 0.23494765,
       0.19958681, 0.15557526, 0.33331007, 0.23102304, 0.23096627,
       0.18365952, 0.20450184, 0.15579894, 0.26125488, 0.17457041,
       0.19564763, 0.1797381 , 0.1983908 , 0.17448528, 0.21219534,
       0.17955977, 0.20927945, 0.25814843, 0.2739669 , 0.16638389,
       0.21490885, 0.17660362, 0.2447116 , 0.18306579, 0.18558434,
       0.16813457, 0.23376551, 0.19930786, 0.19331878, 0.1550057 ],
      dtype=float32))
('After %d steps,loss is :%f', 24000, array([0.7494222 , 0.613317  , 1.5214691 , 0.72036934, 1.1427875 ,
       0.8024695 , 1.713857  , 0.41689628, 1.1055427 , 0.7509031 ,
       1.3844378 , 0.77810514, 1.487841  , 0.87404466, 1.2230209 ,
       0.3875419 , 1.2655963 , 0.4285356 , 0.27371174, 0.15762192,
       0.24405114, 0.1563472 , 0.27385342, 0.14268164, 0.24636799,
       0.18721986, 0.2510159 , 0.14373362, 0.25838265, 0.13898624,
       0.23098189, 0.19360706, 1.6892916 , 0.58767235, 1.8122717 ,
       0.19637552, 0.24108365, 0.22105703, 0.2259263 , 0.16409503,
       0.2380073 , 0.1908282 , 0.26201746, 0.19953227, 0.2547223 ,
       0.13867414, 0.22494149, 0.16478299, 0.23329166, 0.22949305,
       0.19413221, 0.15012065, 0.32785544, 0.22556843, 0.22551164,
       0.17820491, 0.19904722, 0.15034433, 0.25580025, 0.1691158 ,
       0.190193  , 0.17428349, 0.19293618, 0.16903067, 0.20674072,
       0.17410515, 0.20382483, 0.25269383, 0.2685123 , 0.16092926,
       0.20945424, 0.171149  , 0.23925698, 0.17761117, 0.1801297 ,
       0.16267996, 0.2283109 , 0.19385323, 0.18699816, 0.1500963 ],
      dtype=float32))
('After %d steps,loss is :%f', 26000, array([0.7447367 , 0.60863155, 1.5167837 , 0.71568394, 1.138102  ,
       0.797784  , 1.7091717 , 0.41221082, 1.1008573 , 0.7462176 ,
       1.3797524 , 0.77341974, 1.4831556 , 0.86935925, 1.2183355 ,
       0.38285643, 1.2609109 , 0.42385015, 0.26902628, 0.15293646,
       0.23936568, 0.15166174, 0.26916796, 0.13799618, 0.24168253,
       0.1825344 , 0.24633043, 0.13904816, 0.2536972 , 0.13430078,
       0.22629642, 0.1889216 , 1.6846062 , 0.5829869 , 1.8075863 ,
       0.19169006, 0.23639819, 0.21637157, 0.22124083, 0.15940957,
       0.23332185, 0.18614274, 0.257332  , 0.19484681, 0.25003684,
       0.13398868, 0.22025603, 0.16009752, 0.2286062 , 0.22480759,
       0.18944675, 0.14543518, 0.32316998, 0.22088297, 0.22082618,
       0.17351945, 0.19436176, 0.14565887, 0.2511148 , 0.16443034,
       0.18550754, 0.16959803, 0.18825072, 0.1643452 , 0.20205526,
       0.16941969, 0.19913937, 0.24800836, 0.26382685, 0.1562438 ,
       0.20476878, 0.16646354, 0.23457152, 0.17292571, 0.17544425,
       0.1579945 , 0.22362544, 0.18916777, 0.18159589, 0.14614457],
      dtype=float32))
('After %d steps,loss is :%f', 28000, array([0.7413303 , 0.6052252 , 1.5133773 , 0.71227753, 1.1346956 ,
       0.7943776 , 1.7057652 , 0.40880448, 1.0974509 , 0.74281126,
       1.376346  , 0.77001333, 1.4797492 , 0.86595285, 1.2149291 ,
       0.37945008, 1.2575045 , 0.42044377, 0.26561993, 0.1495301 ,
       0.23595932, 0.14825538, 0.2657616 , 0.13458982, 0.23827617,
       0.17912802, 0.24292406, 0.1356418 , 0.2502908 , 0.13089442,
       0.22289008, 0.18551525, 1.6811998 , 0.57958055, 1.8041799 ,
       0.18828368, 0.23299184, 0.21296519, 0.21783447, 0.1560032 ,
       0.22991548, 0.18273637, 0.25392562, 0.19144043, 0.24663049,
       0.13058232, 0.21684965, 0.15669116, 0.22519983, 0.22140121,
       0.18604037, 0.14202882, 0.3197636 , 0.2174766 , 0.21741983,
       0.17011309, 0.1909554 , 0.1422525 , 0.24770844, 0.16102397,
       0.18210119, 0.16619167, 0.18484436, 0.16093884, 0.1986489 ,
       0.16601333, 0.19573301, 0.244602  , 0.26042047, 0.15283746,
       0.20136242, 0.16305718, 0.23116516, 0.16951935, 0.1720379 ,
       0.15458813, 0.22021908, 0.18576142, 0.17811957, 0.14364406],
      dtype=float32))
('After %d steps,loss is :%f', 30000, array([0.73724467, 0.6011395 , 1.5092916 , 0.7081919 , 1.13061   ,
       0.79029197, 1.7016796 , 0.40471876, 1.0933652 , 0.7387256 ,
       1.3722603 , 0.7659277 , 1.4756635 , 0.8618672 , 1.2108434 ,
       0.37536436, 1.2534188 , 0.4163581 , 0.26153424, 0.14544441,
       0.23187363, 0.14416969, 0.26167592, 0.13050413, 0.23419048,
       0.17504233, 0.23883837, 0.13155611, 0.24620514, 0.12680873,
       0.21880439, 0.18142956, 1.6771141 , 0.5754948 , 1.8000942 ,
       0.18419799, 0.22890615, 0.2088795 , 0.21374878, 0.15191752,
       0.2258298 , 0.17865068, 0.24983995, 0.18735474, 0.2425448 ,
       0.12649663, 0.21276397, 0.15260547, 0.22111414, 0.21731552,
       0.18195468, 0.13794313, 0.31567794, 0.21339092, 0.21333414,
       0.1660274 , 0.18686971, 0.13816682, 0.24362275, 0.15693828,
       0.1780155 , 0.16210598, 0.18075867, 0.15685315, 0.19456321,
       0.16192764, 0.19164732, 0.2405163 , 0.25633478, 0.14875177,
       0.19727673, 0.15897149, 0.22707947, 0.16543366, 0.16795221,
       0.15050244, 0.21613339, 0.18167573, 0.17478454, 0.14061294],
      dtype=float32))
('After %d steps,loss is :%f', 32000, array([0.7330661 , 0.59696096, 1.5051131 , 0.7040133 , 1.1264315 ,
       0.7861134 , 1.6975011 , 0.4005402 , 1.0891867 , 0.734547  ,
       1.3680818 , 0.7617491 , 1.471485  , 0.8576886 , 1.2066649 ,
       0.3711858 , 1.2492403 , 0.41217953, 0.2573557 , 0.14126585,
       0.22769508, 0.13999113, 0.25749737, 0.12632558, 0.23001191,
       0.17086378, 0.23465982, 0.12737754, 0.24202657, 0.12263018,
       0.21462582, 0.177251  , 1.6729356 , 0.5713163 , 1.7959157 ,
       0.18001944, 0.22472759, 0.20470095, 0.20957023, 0.14773896,
       0.22165123, 0.17447212, 0.24566138, 0.18317619, 0.23836625,
       0.12231806, 0.20858541, 0.1484269 , 0.21693558, 0.21313697,
       0.17777613, 0.13376456, 0.31149936, 0.20921236, 0.20915557,
       0.16184884, 0.18269116, 0.13398826, 0.2394442 , 0.15275972,
       0.17383693, 0.15792742, 0.1765801 , 0.15267459, 0.19038466,
       0.15774909, 0.18746877, 0.23633775, 0.25215623, 0.1445732 ,
       0.19309816, 0.15479292, 0.2229009 , 0.16125509, 0.16377364,
       0.14632389, 0.21195483, 0.17749716, 0.17114249, 0.13762349],
      dtype=float32))
('After %d steps,loss is :%f', 34000, array([0.7292618 , 0.5931567 , 1.5013088 , 0.700209  , 1.1226271 ,
       0.7823091 , 1.6936967 , 0.39673594, 1.0853823 , 0.73074275,
       1.3642775 , 0.7579448 , 1.4676807 , 0.85388434, 1.2028606 ,
       0.36738154, 1.245436  , 0.40837526, 0.25355142, 0.13746159,
       0.22389081, 0.13618687, 0.2536931 , 0.12252131, 0.22620764,
       0.16705951, 0.23085555, 0.12357328, 0.2382223 , 0.11882591,
       0.21082155, 0.17344673, 1.6691313 , 0.56751204, 1.7921114 ,
       0.17621517, 0.22092332, 0.20089668, 0.20576596, 0.1439347 ,
       0.21784696, 0.17066786, 0.24185711, 0.17937192, 0.23456198,
       0.11851379, 0.20478114, 0.14462264, 0.21313131, 0.2093327 ,
       0.17397186, 0.1299603 , 0.3076951 , 0.2054081 , 0.20535131,
       0.15804458, 0.17888689, 0.130184  , 0.23563993, 0.14895545,
       0.17003267, 0.15412316, 0.17277583, 0.14887032, 0.18658039,
       0.15394482, 0.1836645 , 0.23253348, 0.24835196, 0.14076893,
       0.18929389, 0.15098865, 0.21909663, 0.15745082, 0.15996937,
       0.14251962, 0.20815057, 0.1736929 , 0.16773093, 0.13510643],
      dtype=float32))
('After %d steps,loss is :%f', 36000, array([0.7257618 , 0.5896566 , 1.4978087 , 0.696709  , 1.119127  ,
       0.7788091 , 1.6901966 , 0.3932359 , 1.0818822 , 0.7272427 ,
       1.3607774 , 0.7544448 , 1.4641806 , 0.8503843 , 1.1993605 ,
       0.3638815 , 1.2419358 , 0.40487522, 0.25005135, 0.13396153,
       0.22039074, 0.1326868 , 0.25019303, 0.11902125, 0.2227076 ,
       0.16355945, 0.22735548, 0.12007322, 0.23472226, 0.11532585,
       0.2073215 , 0.16994667, 1.6656312 , 0.56401193, 1.7886113 ,
       0.17271511, 0.21742326, 0.19739662, 0.20226589, 0.14043462,
       0.21434692, 0.1671678 , 0.23835707, 0.17587186, 0.2310619 ,
       0.11501373, 0.20128109, 0.14112258, 0.20963126, 0.20583265,
       0.1704718 , 0.12646025, 0.30419505, 0.20190802, 0.20185125,
       0.1545445 , 0.17538682, 0.12668392, 0.23213986, 0.14545539,
       0.1665326 , 0.1506231 , 0.16927579, 0.14537027, 0.18308032,
       0.15044475, 0.18016443, 0.22903341, 0.24485189, 0.13726887,
       0.18579385, 0.1474886 , 0.21559659, 0.15395077, 0.15646932,
       0.13901956, 0.20465049, 0.17019284, 0.16452476, 0.13297679],
      dtype=float32))
('After %d steps,loss is :%f', 38000, array([0.72215027, 0.58604515, 1.4941972 , 0.6930975 , 1.1155156 ,
       0.77519757, 1.6865852 , 0.38962442, 1.0782708 , 0.7236312 ,
       1.3571659 , 0.7508333 , 1.4605691 , 0.8467728 , 1.195749  ,
       0.36027002, 1.2383244 , 0.40126374, 0.24643987, 0.13035005,
       0.21677926, 0.12907532, 0.24658155, 0.11540978, 0.21909612,
       0.15994798, 0.223744  , 0.11646175, 0.23111078, 0.11171438,
       0.20371002, 0.1663352 , 1.6620197 , 0.5604005 , 1.7849998 ,
       0.16910364, 0.21381178, 0.19378515, 0.19865441, 0.13682315,
       0.21073544, 0.16355632, 0.23474559, 0.17226039, 0.22745043,
       0.11140226, 0.19766961, 0.1375111 , 0.20601979, 0.20222117,
       0.16686033, 0.12284877, 0.30058357, 0.19829655, 0.19823977,
       0.15093303, 0.17177534, 0.12307245, 0.22852838, 0.14184391,
       0.16292113, 0.14701162, 0.16566432, 0.1417588 , 0.17946884,
       0.14683327, 0.17655295, 0.22542194, 0.24124041, 0.1336574 ,
       0.18218237, 0.14387712, 0.21198511, 0.15033929, 0.15285784,
       0.13540809, 0.20103902, 0.16658136, 0.16109818, 0.13084105],
      dtype=float32))
[[-1.7779841  -0.00345994  0.41391835  1.0066968   0.09999095 -0.09303896
   1.1504605   0.55715525  0.8000681  -0.28293207  1.1202246 ]
 [-0.11100025 -0.0628902  -0.0661696  -0.20525452  1.0270495   0.5424059
   0.9591054   0.31853572 -0.51170963  1.2519913   1.3641579 ]]
[-0.130164   -0.14720179 -0.7307611   0.17783903  0.54072183 -0.9243654
  0.5413562   0.04189619 -0.12677328 -0.04429227  0.3993499 ]
[[-0.16530047]
 [ 0.49162793]
 [ 1.2339754 ]
 [ 0.37211806]
 [ 0.78846484]
 [ 1.1733276 ]
 [ 1.0060463 ]
 [-1.0291201 ]
 [-0.8715099 ]
 [-0.72147506]
 [-0.97718334]]
[0.84805065]

('After %d steps,loss is :%f', 0, array([3.8315601, 2.7889977, 3.3969386, 3.0280333, 3.3199768, 3.2133098,
       3.7826958, 2.7785528, 3.1087153, 3.1512306, 4.14266  , 2.9616723,
       3.3121846, 3.4314332, 3.1668963, 2.8639708, 3.8196497, 3.3188386,
       2.5825505, 2.5082152, 2.5282617, 2.467965 , 2.5252242, 2.4822373,
       2.5347128, 2.4850569, 2.5453405, 2.5611465, 2.5488033, 2.540742 ,
       2.5124037, 2.4649096, 4.033128 , 3.0623012, 3.2773528, 2.4731717,
       2.481172 , 2.48113  , 2.5901496, 2.5208285, 2.5309553, 2.486297 ,
       2.5285196, 2.5410357, 2.6087956, 2.5476315, 2.5462852, 2.5123014,
       2.5451865, 2.4921875, 2.5533166, 2.4965446, 2.551011 , 2.539789 ,
       2.5706098, 2.450054 , 2.5490584, 2.4830463, 2.5460024, 2.4597282,
       2.5367968, 2.4788527, 2.5069199, 2.5013967, 2.511752 , 2.525803 ,
       2.6034837, 2.5103989, 2.5333908, 2.4856548, 2.5720544, 2.4801147,
       2.532696 , 2.516683 , 2.5493698, 2.5091205, 2.5042243, 2.486913 ,
       2.5539706, 2.4728928], dtype=float32))
('After %d steps,loss is :%f', 2000, array([1.4164765 , 0.6261104 , 1.0976706 , 0.82821906, 0.98835874,
       1.000843  , 1.3762441 , 0.60629296, 0.8327279 , 0.9368299 ,
       1.7030766 , 0.7705244 , 1.0413702 , 1.162133  , 0.8893672 ,
       0.68475825, 1.3953032 , 1.0767454 , 0.5104373 , 0.45415634,
       0.46640038, 0.42164633, 0.46403682, 0.43560913, 0.4703771 ,
       0.43497878, 0.47726297, 0.5033024 , 0.48108125, 0.4840132 ,
       0.45225468, 0.41944876, 1.6149333 , 0.8506696 , 0.9815061 ,
       0.42653152, 0.42837268, 0.43346557, 0.5165088 , 0.4680069 ,
       0.47051087, 0.43743038, 0.4718633 , 0.48512807, 0.53446645,
       0.488753  , 0.4784186 , 0.4583788 , 0.47941858, 0.44199133,
       0.48853254, 0.44407645, 0.48621213, 0.4838206 , 0.50209045,
       0.40883136, 0.48392403, 0.43471855, 0.48138237, 0.41558838,
       0.4750949 , 0.4295599 , 0.44802296, 0.44864032, 0.45514196,
       0.4706951 , 0.5284747 , 0.45597628, 0.47058204, 0.4368105 ,
       0.50136155, 0.43045765, 0.46949425, 0.4641615 , 0.4850613 ,
       0.4569933 , 0.44746053, 0.43751082, 0.51576376, 0.43403062],
      dtype=float32))
('After %d steps,loss is :%f', 4000, array([0.8967347 , 0.30704334, 0.67342687, 0.4773066 , 0.5501083 ,
       0.6330831 , 0.8611952 , 0.28211573, 0.4390933 , 0.56530094,
       1.1603608 , 0.4254379 , 0.6409825 , 0.7450361 , 0.48853073,
       0.34872174, 0.86443615, 0.67862153, 0.24853957, 0.20639804,
       0.21363118, 0.18122685, 0.21198225, 0.19438499, 0.21616669,
       0.19107108, 0.21980727, 0.25124514, 0.22351672, 0.23300067,
       0.2016267 , 0.17955062, 1.0823139 , 0.48264316, 0.5707583 ,
       0.18555818, 0.18470581, 0.1914156 , 0.25339544, 0.22090572,
       0.21901983, 0.19413272, 0.22295457, 0.23535231, 0.27046713,
       0.23616904, 0.2207922 , 0.21053156, 0.2234234 , 0.19751827,
       0.23321146, 0.1979597 , 0.2310144 , 0.23426025, 0.24340619,
       0.1722014 , 0.22826737, 0.19201855, 0.22584392, 0.17673983,
       0.22211994, 0.1865835 , 0.19845963, 0.20206052, 0.20742191,
       0.22162667, 0.2641204 , 0.20794411, 0.21754028, 0.19352955,
       0.24115679, 0.18669385, 0.2162392 , 0.21709277, 0.22976616,
       0.21083134, 0.19951953, 0.19414267, 0.2801684 , 0.20084967],
      dtype=float32))
('After %d steps,loss is :%f', 6000, array([0.61806744, 0.18606085, 0.4659688 , 0.3287254 , 0.34648916,
       0.4638761 , 0.58321893, 0.16259259, 0.2702219 , 0.39202544,
       0.8571388 , 0.28125763, 0.45122823, 0.53733444, 0.31137305,
       0.21303543, 0.5733276 , 0.48080903, 0.16325423, 0.13212185,
       0.13638765, 0.11374407, 0.13493969, 0.12532239, 0.13798127,
       0.1205424 , 0.13905835, 0.17253818, 0.14216144, 0.15525407,
       0.12628223, 0.1121821 , 0.78142756, 0.31685767, 0.3864083 ,
       0.117254  , 0.11557417, 0.12227145, 0.16708045, 0.14675567,
       0.14248021, 0.1237416 , 0.14816944, 0.15875301, 0.18292455,
       0.15732086, 0.13965659, 0.13608049, 0.14322886, 0.1261213 ,
       0.15330637, 0.12544596, 0.15159494, 0.1580885 , 0.16065624,
       0.10749026, 0.14814584, 0.12201539, 0.14576206, 0.11030713,
       0.14383681, 0.1169657 , 0.12416864, 0.12894419, 0.13394919,
       0.14589599, 0.1764795 , 0.1335361 , 0.14005366, 0.12308785,
       0.1572946 , 0.11632921, 0.1389045 , 0.14275125, 0.14955033,
       0.13785012, 0.12628622, 0.12371968, 0.21501581, 0.1390738 ],
      dtype=float32))
('After %d steps,loss is :%f', 8000, array([0.44300532, 0.13375577, 0.34072942, 0.2500427 , 0.23618145,
       0.36189795, 0.4070921 , 0.11550375, 0.18767084, 0.2881418 ,
       0.6541178 , 0.20671469, 0.33801252, 0.4099114 , 0.219614  ,
       0.1471094 , 0.38768274, 0.35676455, 0.13014138, 0.10757202,
       0.11023684, 0.09509838, 0.1087015 , 0.10460943, 0.11133046,
       0.09949879, 0.11055624, 0.1436727 , 0.11272777, 0.12720613,
       0.10196207, 0.09350836, 0.5797986 , 0.22565505, 0.28807843,
       0.0977099 , 0.09601626, 0.1021981 , 0.13327336, 0.12167109,
       0.11658382, 0.10247823, 0.12335943, 0.13155773, 0.14758793,
       0.12864023, 0.1107414 , 0.11126105, 0.11461506, 0.10408644,
       0.12436683, 0.10270428, 0.12350322, 0.13132726, 0.12926681,
       0.09099469, 0.11917261, 0.10087523, 0.11701462, 0.09245258,
       0.1161116 , 0.0966755 , 0.10074179, 0.10555532, 0.11013977,
       0.11977165, 0.1410501 , 0.10892678, 0.11346547, 0.10169141,
       0.12525229, 0.09561346, 0.11288366, 0.11759671, 0.12038894,
       0.1142984 , 0.1031095 , 0.10230704, 0.19759133, 0.12378968],
      dtype=float32))
('After %d steps,loss is :%f', 10000, array([0.32009584, 0.10576597, 0.25269046, 0.19665202, 0.1663762 ,
       0.28373396, 0.28415436, 0.09345199, 0.14098202, 0.21246037,
       0.5022291 , 0.15844876, 0.25771803, 0.31826088, 0.16288194,
       0.10801959, 0.2611403 , 0.26602435, 0.1099822 , 0.09412275,
       0.09597585, 0.08631223, 0.09445781, 0.09376308, 0.09687794,
       0.08902208, 0.09503894, 0.12614703, 0.09617884, 0.11035262,
       0.08952205, 0.08492941, 0.43287653, 0.16609469, 0.22451454,
       0.08820808, 0.08670995, 0.0922244 , 0.11283782, 0.10702778,
       0.10218063, 0.09159449, 0.10944249, 0.11516864, 0.12544523,
       0.11157724, 0.09496263, 0.0974023 , 0.09853921, 0.09264185,
       0.10732996, 0.09091774, 0.10736465, 0.11541791, 0.11024527,
       0.0838934 , 0.1021491 , 0.09005377, 0.10065387, 0.08442172,
       0.1001766 , 0.08682499, 0.08903737, 0.09311035, 0.0969811 ,
       0.10470344, 0.11872134, 0.09536745, 0.09855348, 0.09059753,
       0.10606409, 0.0857481 , 0.09882059, 0.10319855, 0.10335989,
       0.10142526, 0.0908798 , 0.09122632, 0.18895668, 0.11688314],
      dtype=float32))
('After %d steps,loss is :%f', 12000, array([0.23078321, 0.08917277, 0.18860815, 0.15675253, 0.11987503,
       0.22013049, 0.19781615, 0.08218265, 0.1131959 , 0.15683112,
       0.38537544, 0.12585106, 0.19764876, 0.2493082 , 0.12553084,
       0.08620736, 0.17805982, 0.19854502, 0.09529562, 0.08470993,
       0.08618961, 0.08029978, 0.08488017, 0.08592   , 0.08697579,
       0.08182814, 0.08469796, 0.11287934, 0.0850398 , 0.09777563,
       0.08136645, 0.07930737, 0.32584903, 0.12623715, 0.17970586,
       0.08162995, 0.08037493, 0.08506839, 0.09822831, 0.09585629,
       0.09180801, 0.08394414, 0.09901795, 0.10262357, 0.10893879,
       0.09902772, 0.08463778, 0.08743821, 0.08757547, 0.08456697,
       0.09494847, 0.0828018 , 0.09556761, 0.10345443, 0.09641954,
       0.07901472, 0.08982265, 0.08254611, 0.0893515 , 0.07912134,
       0.08891137, 0.08028004, 0.08149494, 0.0843951 , 0.08739027,
       0.09367657, 0.10222173, 0.08569508, 0.08795631, 0.08278169,
       0.0924245 , 0.07950289, 0.08914387, 0.09261385, 0.09117462,
       0.09204245, 0.08252899, 0.08342551, 0.1822569 , 0.11202389],
      dtype=float32))
('After %d steps,loss is :%f', 14000, array([0.16735694, 0.08021397, 0.14281112, 0.12710565, 0.09214684,
       0.17038535, 0.14065222, 0.07694671, 0.09598851, 0.11952355,
       0.29566258, 0.10453033, 0.15261072, 0.19783455, 0.10137041,
       0.07754464, 0.12900056, 0.15070885, 0.08563829, 0.0791546 ,
       0.08034473, 0.07691224, 0.07937448, 0.08105212, 0.08104889,
       0.07764769, 0.07877371, 0.10348774, 0.07875009, 0.08931809,
       0.07701254, 0.07636799, 0.24910706, 0.10156642, 0.14743654,
       0.07779405, 0.07685091, 0.08053764, 0.08874423, 0.08802476,
       0.08502898, 0.07934942, 0.09175536, 0.09371518, 0.09742174,
       0.09064542, 0.0787965 , 0.08117601, 0.08108454, 0.07958808,
       0.08687979, 0.07805468, 0.08753648, 0.09529039, 0.08742063,
       0.07632972, 0.08198829, 0.07811991, 0.08240972, 0.07633703,
       0.08198413, 0.07678171, 0.07745489, 0.07920143, 0.0812943 ,
       0.08643446, 0.09108397, 0.07976591, 0.08134556, 0.07815702,
       0.08386261, 0.07640675, 0.08323823, 0.08568425, 0.08344976,
       0.08592293, 0.07784953, 0.07874785, 0.17714547, 0.1093974 ],
      dtype=float32))
('After %d steps,loss is :%f', 16000, array([0.12351368, 0.07498599, 0.10979019, 0.10499714, 0.07802693,
       0.1323273 , 0.10454233, 0.07411464, 0.08410102, 0.0957509 ,
       0.22586632, 0.089705  , 0.11894818, 0.15783393, 0.08535192,
       0.07416581, 0.10107116, 0.11775395, 0.07883778, 0.07531052,
       0.07608883, 0.07427487, 0.0755752 , 0.07719377, 0.0767929 ,
       0.07453603, 0.0748823 , 0.09571391, 0.07481109, 0.08291209,
       0.07418539, 0.07409194, 0.19293167, 0.08606832, 0.1228013 ,
       0.0747915 , 0.07422598, 0.07681353, 0.08186498, 0.08169913,
       0.07973921, 0.07583643, 0.08568696, 0.08643787, 0.08865338,
       0.08418686, 0.0748917 , 0.07659034, 0.07656834, 0.07575826,
       0.08088799, 0.07465619, 0.08119145, 0.088843  , 0.08084389,
       0.07409126, 0.07655182, 0.07480718, 0.07732973, 0.07409128,
       0.07708351, 0.07420495, 0.0745473 , 0.07546709, 0.07679801,
       0.08089273, 0.08291531, 0.07560199, 0.07665101, 0.07481227,
       0.07795612, 0.07409515, 0.07874972, 0.0803453 , 0.07792816,
       0.081076  , 0.07463851, 0.0752039 , 0.17159143, 0.10720392],
      dtype=float32))
('After %d steps,loss is :%f', 18000, array([0.09643175, 0.07319309, 0.08864243, 0.09040855, 0.07351926,
       0.10610077, 0.08464576, 0.07313987, 0.07709179, 0.08264283,
       0.17316596, 0.08051211, 0.09643535, 0.12732074, 0.07681769,
       0.07313998, 0.08581083, 0.09726303, 0.07520419, 0.07354973,
       0.07396525, 0.07316507, 0.07380991, 0.07500832, 0.07459033,
       0.07321247, 0.0732794 , 0.09003073, 0.07325427, 0.07900421,
       0.07314159, 0.07313986, 0.15277532, 0.07776551, 0.10481241,
       0.07338344, 0.07315341, 0.07472485, 0.07775228, 0.0776784 ,
       0.07662133, 0.07402591, 0.08159804, 0.08148673, 0.08304107,
       0.08001921, 0.07327773, 0.07422961, 0.07430366, 0.07382114,
       0.07735749, 0.0732343 , 0.07720298, 0.08459492, 0.07694463,
       0.07313986, 0.07395395, 0.0733205 , 0.07456306, 0.07313986,
       0.07451305, 0.07314962, 0.07326405, 0.07369173, 0.0744935 ,
       0.07749788, 0.07793561, 0.07366017, 0.07433947, 0.0733578 ,
       0.07480198, 0.07313986, 0.07617539, 0.07711886, 0.07497213,
       0.07809266, 0.07328843, 0.07351726, 0.16640744, 0.10632571],
      dtype=float32))
('After %d steps,loss is :%f', 20000, array([0.08153679, 0.07260597, 0.07720426, 0.08100697, 0.0726087 ,
       0.08954952, 0.07522895, 0.07260592, 0.07352827, 0.0758723 ,
       0.1337563 , 0.07511264, 0.0824512 , 0.10465631, 0.07328556,
       0.07260592, 0.07756328, 0.08478416, 0.07328275, 0.07268546,
       0.07287399, 0.07260624, 0.07283312, 0.07357947, 0.07328569,
       0.07260756, 0.07261093, 0.08548389, 0.07260875, 0.07634095,
       0.07260592, 0.07260592, 0.12335496, 0.0737818 , 0.09132122,
       0.07264846, 0.07260599, 0.07338735, 0.07508933, 0.07502777,
       0.07462572, 0.07295153, 0.07857858, 0.07790661, 0.07925232,
       0.07700416, 0.07261149, 0.07297808, 0.07305559, 0.07279997,
       0.07510556, 0.07260866, 0.07459899, 0.08135692, 0.07450204,
       0.07260592, 0.07278721, 0.07262352, 0.07305185, 0.07260592,
       0.07308564, 0.07260595, 0.07261764, 0.07276344, 0.07320402,
       0.07518026, 0.07486467, 0.07270984, 0.07309311, 0.07264014,
       0.07311162, 0.07260592, 0.07442338, 0.0749586 , 0.07333194,
       0.07592044, 0.07262261, 0.07268102, 0.16174343, 0.10588211],
      dtype=float32))
('After %d steps,loss is :%f', 22000, array([0.07468367, 0.07218245, 0.07281619, 0.07523491, 0.07218245,
       0.07996398, 0.07234   , 0.07218245, 0.07223928, 0.07283373,
       0.10553174, 0.07259706, 0.07492447, 0.08900751, 0.07221074,
       0.07218245, 0.07349365, 0.07730696, 0.07230287, 0.07218663,
       0.07223197, 0.07218245, 0.07221994, 0.07257865, 0.07241522,
       0.07218245, 0.07218245, 0.08174249, 0.07218245, 0.07440591,
       0.07218245, 0.07218245, 0.10193163, 0.07227731, 0.08163685,
       0.07218358, 0.07218245, 0.07246961, 0.07336798, 0.07331952,
       0.07323913, 0.07226098, 0.07624527, 0.07526237, 0.07660316,
       0.07475881, 0.07218245, 0.07226328, 0.07229971, 0.07220885,
       0.07356917, 0.07218245, 0.07296537, 0.07864918, 0.07295652,
       0.07218245, 0.07219776, 0.07218257, 0.07226238, 0.07218245,
       0.0722776 , 0.07218245, 0.0721825 , 0.07220117, 0.07237332,
       0.07355552, 0.07306419, 0.07218809, 0.07231908, 0.07218312,
       0.07225568, 0.07218245, 0.07312094, 0.07344585, 0.07238056,
       0.0742121 , 0.07218257, 0.07218638, 0.15911019, 0.10554218],
      dtype=float32))
('After %d steps,loss is :%f', 24000, array([0.07219975, 0.07181777, 0.07183018, 0.07240831, 0.07181777,
       0.07452814, 0.07181795, 0.07181777, 0.07181783, 0.07184418,
       0.08736915, 0.07182706, 0.0721258 , 0.07934991, 0.07181778,
       0.07181777, 0.0719364 , 0.07323394, 0.07182304, 0.07181777,
       0.07181937, 0.07181777, 0.07181861, 0.07191654, 0.07185695,
       0.07181777, 0.07181777, 0.07871617, 0.07181777, 0.07301803,
       0.07181777, 0.07181777, 0.0873319 , 0.07181799, 0.07545375,
       0.07181777, 0.07181777, 0.07187479, 0.072307  , 0.07227571,
       0.07226295, 0.07182226, 0.07441905, 0.07335979, 0.07467109,
       0.07316858, 0.07181777, 0.07182252, 0.07182819, 0.07181813,
       0.07246876, 0.07181777, 0.07204729, 0.07636786, 0.07203686,
       0.07181777, 0.07181785, 0.07181777, 0.07182187, 0.07181777,
       0.07182305, 0.07181777, 0.07181777, 0.07181792, 0.07184491,
       0.0724463 , 0.07205002, 0.07181778, 0.07183196, 0.07181777,
       0.07181919, 0.07181777, 0.07219352, 0.07238779, 0.07184264,
       0.07290336, 0.07181777, 0.07181777, 0.15743685, 0.10523674],
      dtype=float32))
('After %d steps,loss is :%f', 26000, array([0.07146223, 0.07145459, 0.07145459, 0.07147575, 0.07145459,
       0.07193232, 0.07145459, 0.07145459, 0.07145459, 0.0714546 ,
       0.07745631, 0.07145459, 0.07145798, 0.07399798, 0.07145459,
       0.07145459, 0.071455  , 0.07159325, 0.0714546 , 0.07145459,
       0.07145459, 0.07145459, 0.07145459, 0.07146191, 0.07145552,
       0.07145459, 0.07145459, 0.07627454, 0.07145459, 0.07198755,
       0.07145459, 0.07145459, 0.07835912, 0.07145459, 0.07225508,
       0.07145459, 0.07145459, 0.0714568 , 0.07159349, 0.07157937,
       0.07157424, 0.07145459, 0.07295053, 0.07205936, 0.07313614,
       0.07206014, 0.07145459, 0.0714546 , 0.07145463, 0.07145459,
       0.07167257, 0.07145459, 0.07149124, 0.07444761, 0.07148449,
       0.07145459, 0.07145459, 0.07145459, 0.07145459, 0.07145459,
       0.0714546 , 0.07145459, 0.07145459, 0.07145459, 0.07145497,
       0.07166102, 0.07147522, 0.07145459, 0.07145467, 0.07145459,
       0.07145459, 0.07145459, 0.07154501, 0.07163209, 0.0714549 ,
       0.07191755, 0.07145459, 0.07145459, 0.1561044 , 0.10494801],
      dtype=float32))
('After %d steps,loss is :%f', 28000, array([0.07117983, 0.07117983, 0.07117983, 0.07117984, 0.07117983,
       0.0711928 , 0.07117983, 0.07117983, 0.07117983, 0.07117983,
       0.07290075, 0.07117983, 0.07117983, 0.07160551, 0.07117983,
       0.07117983, 0.07117983, 0.07118044, 0.07117983, 0.07117983,
       0.07117983, 0.07117983, 0.07117983, 0.07117984, 0.07117983,
       0.07117983, 0.07117983, 0.07437957, 0.07117983, 0.07133952,
       0.07117983, 0.07117983, 0.07343049, 0.07117983, 0.07122161,
       0.07117983, 0.07117983, 0.07117983, 0.0711945 , 0.07119166,
       0.0711907 , 0.07117983, 0.07190239, 0.0713381 , 0.07202592,
       0.07137442, 0.07117983, 0.07117983, 0.07117983, 0.07117983,
       0.07121457, 0.07117983, 0.07118062, 0.0729664 , 0.07118031,
       0.07117983, 0.07117983, 0.07117983, 0.07117983, 0.07117983,
       0.07117983, 0.07117983, 0.07117983, 0.07117983, 0.07117983,
       0.07121124, 0.0711799 , 0.07117983, 0.07117983, 0.07117983,
       0.07117983, 0.07117983, 0.0711859 , 0.07120347, 0.07117983,
       0.07130733, 0.07117983, 0.07117983, 0.1550209 , 0.10471465],
      dtype=float32))
('After %d steps,loss is :%f', 30000, array([0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07114991, 0.07094616, 0.07094616, 0.07095605, 0.07094616,
       0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094616, 0.07094616, 0.07288858, 0.07094616, 0.07096545,
       0.07094616, 0.07094616, 0.07128607, 0.07094616, 0.07094619,
       0.07094616, 0.07094616, 0.07094616, 0.07094625, 0.07094621,
       0.0709462 , 0.07094616, 0.07120156, 0.07096386, 0.07126917,
       0.07097431, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094686, 0.07094616, 0.07094616, 0.07186353, 0.07094616,
       0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094616, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094671, 0.07094616, 0.07094616, 0.07094616, 0.07094616,
       0.07094616, 0.07094616, 0.07094617, 0.07094644, 0.07094616,
       0.07095852, 0.07094616, 0.07094616, 0.1540249 , 0.10450707],
      dtype=float32))
('After %d steps,loss is :%f', 32000, array([0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07076006, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07178316, 0.07075843, 0.0707586 ,
       0.07075843, 0.07075843, 0.0707642 , 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07080475, 0.07075857, 0.07082838,
       0.07075885, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07112198, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075843, 0.07075843, 0.07075843, 0.07075843, 0.07075843,
       0.07075848, 0.07075843, 0.07075843, 0.15314656, 0.10432389],
      dtype=float32))
('After %d steps,loss is :%f', 34000, array([0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.07101902, 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.07059397, 0.0705926 , 0.07059608,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.07067814, 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 , 0.0705926 ,
       0.0705926 , 0.0705926 , 0.0705926 , 0.15234238, 0.10415206],
      dtype=float32))
('After %d steps,loss is :%f', 36000, array([0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07055069, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07044456, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.07043917, 0.07043917,
       0.07043917, 0.07043917, 0.07043917, 0.15159732, 0.10398917],
      dtype=float32))
('After %d steps,loss is :%f', 38000, array([0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07031652, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.07030711, 0.07030711,
       0.07030711, 0.07030711, 0.07030711, 0.15089485, 0.10384122],
      dtype=float32))
[[-0.35615185  1.0512278   0.65509987  0.24111895 -0.48807123  0.01505151
  -1.2887135  -1.999117    1.6664442  -0.695121    1.2115469 ]
 [ 0.03836317  0.20670404 -0.7741325   0.3373219   0.72869724  0.1870264
  -0.06267622  0.7101634   0.8343827  -0.85611874  0.6301212 ]]
[ 0.57276255 -0.26923952  0.29363233  0.23405644  0.05097383  0.07222205
  0.2785743  -0.04124863  0.16618761 -0.5340328   0.09621362]
[[ 0.62081915]
 [-1.0401568 ]
 [ 0.21692789]
 [ 1.2833798 ]
 [-1.2685481 ]
 [ 0.36876678]
 [ 0.6006197 ]
 [-0.1263174 ]
 [ 0.02886208]
 [-1.1836926 ]
 [ 0.12205134]]
[0.39568764]

猜你喜欢

转载自blog.csdn.net/ldinvicible/article/details/82828788