久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

196 12-4

 木俊 2018-07-15
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets("/home/mj/MINIST_data", one_hot=True)

x_data = tf.placeholder("float32", [None, 784])
x_image = tf.reshape(x_data, [-1, 28, 28, 1])

w_conv = tf.Variable(tf.ones([5, 5, 1, 32]))
b_conv = tf.Variable(tf.ones([32]))
h_conv = tf.nn.relu(tf.nn.conv2d(x_image, w_conv, strides=[1, 1, 1, 1], padding='SAME') + b_conv)

h_pool = tf.nn.max_pool(h_conv, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')

w_fc = tf.Variable(tf.ones([14 * 14 * 32, 1024]))
b_fc = tf.Variable(tf.ones([1024]))

h_pool_flat = tf.reshape(h_pool,[-1,14*14*32])
h_fc=tf.nn.relu(tf.matmul(h_pool_flat,w_fc)+b_fc)

w_fc2=tf.Variable(tf.ones([1024,10]))
b_fc2=tf.Variable(tf.ones([10]))

y_model=tf.nn.softmax(tf.matmul(h_fc,w_fc2)+b_fc2)

y_data=tf.placeholder("float32",[None,10])

loss=tf.reduce_sum(y_data*tf.log(y_model))
train_step=tf.train.GradientDescentOptimizer(0.01).minimize(loss)
init=tf.initialize_all_variables()
sess=tf.Session()
sess.run(init)

for _ in range(1000):
batch_xs,batch_ys=mnist.train.next_batch(200)
sess.run(train_step,feed_dict={x_data:batch_xs,y_data:batch_ys})
if _ % 50 ==0:
correct_prediction=tf.equal(tf.arg_max(y_model,1),tf.arg_max(y_data,1))
accuracy=tf.reduce_mean(tf.cast(correct_prediction,"float"))
print(sess.run(accuracy,feed_dict={x_data:mnist.test.images,y_data:mnist.test.labels}))

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多