MNIST機器學習入門

http://wiki.jikexueyuan.com/project/tensorflow-zh/tutorials/mnist_beginners.html

其中:
import tensorflow.examples.tutorials.mnist.input_data 
mnist = input_data.read_data_sets(“MNIST_data/”, one_hot=True) 

直接複製運行會報錯, NameError: name ‘input_data’ is not defined

應改成如下代碼: 

import tensorflow.examples.tutorials.mnist.input_data as input_data 
mnist = input_data.read_data_sets(“MNIST_data/”, one_hot=True) 


最後一行代碼


print sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels})


應改爲


print(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章