【发布时间】:2017-06-02 04:35:25
【问题描述】:
我正在学习 TensorFlow,构建一个多层感知器模型。我正在研究一些示例,例如:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/multilayer_perceptron.ipynb
然后我在下面的代码中有一些问题:
def multilayer_perceptron(x, weights, biases):
:
:
pred = multilayer_perceptron(x, weights, biases)
:
:
with tf.Session() as sess:
sess.run(init)
:
correct_prediction = tf.equal(tf.argmax(pred, 1), tf.argmax(y, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float"))
print ("Accuracy:", accuracy.eval({x: X_test, y: y_test_onehot}))
我想知道tf.argmax(prod,1) 和tf.argmax(y,1) 到底是什么意思和返回(类型和值)? correct_prediction 是变量而不是实际值吗?
最后,我们如何从tf会话中得到y_test_prediction数组(输入数据为X_test时的预测结果)?非常感谢!
【问题讨论】:
标签: tensorflow neural-network deep-learning