|
@@ -3,12 +3,14 @@
|
|
|
|
|
|
# In[2]:
|
|
# In[2]:
|
|
|
|
|
|
|
|
+from nt import chdir
|
|
|
|
+mdir="C:/Users/dell/workspace/firstPython/mnist"
|
|
|
|
+chdir(mdir)
|
|
|
|
+
|
|
import tensorflow as tf
|
|
import tensorflow as tf
|
|
import numpy as np
|
|
import numpy as np
|
|
import input_data
|
|
import input_data
|
|
-from nt import chdir
|
|
|
|
|
|
|
|
-chdir("C:/Users/dell/workspace/firstPython/mnist")
|
|
|
|
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
|
|
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
|
|
|
|
|
|
|
|
|
|
@@ -16,6 +18,9 @@ mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
|
|
|
|
|
|
#启动.Tensorflow依赖于一个高效的C++后端来进行计算。与后端的这个连接叫做session。
|
|
#启动.Tensorflow依赖于一个高效的C++后端来进行计算。与后端的这个连接叫做session。
|
|
sess = tf.InteractiveSession()
|
|
sess = tf.InteractiveSession()
|
|
|
|
+#TensorBoard读取的log文件
|
|
|
|
+file_writer = tf.summary.FileWriter('%s%s' % (mdir,'/mnist_logs'), sess.graph)
|
|
|
|
+
|
|
#占位符
|
|
#占位符
|
|
x = tf.placeholder("float", shape=[None, 784])
|
|
x = tf.placeholder("float", shape=[None, 784])
|
|
y_ = tf.placeholder("float", shape=[None, 10])
|
|
y_ = tf.placeholder("float", shape=[None, 10])
|
|
@@ -96,7 +101,7 @@ sess.run(tf.initialize_all_variables())
|
|
# In[8]:
|
|
# In[8]:
|
|
|
|
|
|
#for i in range(20000):
|
|
#for i in range(20000):
|
|
-for i in range(1000):
|
|
|
|
|
|
+for i in range(100):
|
|
batch = mnist.train.next_batch(50)
|
|
batch = mnist.train.next_batch(50)
|
|
if i%100 == 0:
|
|
if i%100 == 0:
|
|
train_accuracy = accuracy.eval(feed_dict={
|
|
train_accuracy = accuracy.eval(feed_dict={
|