使用Feed的Tensorflow

我正在使用下面的代码来创建一个用于分类某些数据的神经网络。

(https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/multilayer_perceptron.py)

我想将我的预测结果与标签进行比较,以便更好地了解NN的工作方式。 所以我使用这段代码:

#y : Labels
tf_y = y
[yp] = sess.run([tf_y], feed_dict = {
        x : test_input, 
        y : test_output
    }
)

ypp = tf.argmax(yp,1)
print(ypp.eval())


#trainpred : prediction
tf_p = trainpred
[p] = sess.run([tf_p], feed_dict = {
        x : test_input, 
        y : test_output
    }
)
pp = tf.argmax(p,1)
print(pp.eval())

它打印一个数组,其中包含标签的标记和预测来比较它们。 我不清楚这部分中feed_dict的用法。 我对此感到困惑,因为我必须将输入传递给占位符,并且在这种情况下,我传递了x测试数据和y测试标签以打印标签和预测。 但我担心我做错了什么,因为我不明白它是如何工作的。 有人可以帮我理解它的用法,以及我应该通过什么样的输入来打印张量值(y)和预测值(trainpred)

链接地址: http://www.djcxy.com/p/32109.html

上一篇: Tensorflow using feed

下一篇: Tensorflow: The priority of value assigning operations