Tensorflow using feed

I am using the following code to make a Neural netowrk for classification of some data.

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

I want to compare the output of my prediction to the labels to better visualize how the NN works. So I am using this piece of code:

#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())

It prints an array containing the indicies of the labels and the prediction to compare them. I don't clearly understand the usage of feed_dict in this part. I am confused about it because I have to pass input to the placeholders and in this case I am passing for x the testing data and for y the testing labels for printing both the labels and the prediction. But I am afraid I am doing something wrong, because I don't understand how it really works. Could someone help me understand its usage and what input should I pass to it to print the value of the tensors both the labels (y) and prediction(trainpred)

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

上一篇: 你必须为占位符张量提供一个值'

下一篇: 使用Feed的Tensorflow