在tensorflow的MNIST教程中,最后一步是使用以下代码输出模型的测试精度:
# Test trained model
correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
print(sess.run(accuracy, feed_dict={x: mnist.test.images,
y_: mnist.test.labels}))
Run Code Online (Sandbox Code Playgroud)
但是,我想知道如何修改此代码以输出测试集的预测值(标签),而不是仅仅打印出准确度?
这是教程的链接:https://www.tensorflow.org/tutorials/mnist/beginners/
graph machine-learning computer-vision deep-learning tensorflow