我无法在张量流中测试训练有素的模型

时间:2017-11-10 15:30:47

标签: tensorflow

I have a DNC model built in tensor flow, after training, now I want to test it against test data I tried everything, but it seems that tensor flow is always requiring the training data to feed the tensor.


with tf.Session(graph=graph) as sess:

    # initialize input output pairs
    tf.initialize_all_variables().run()
    final_i_data = X_train
    final_o_data = y_train
    # for each iteration
    for i in range(0, iterations + 1):
        # feed in each input output pair
        feed_dict = {dnc.i_data: final_i_data, dnc.o_data: final_o_data}
        # make predictions
        l, _, predictions = sess.run([loss, optimizer, output], feed_dict=feed_dict)
        if i % 100 == 0:
            print(i, l)

    for x in X_test:
        x= np.reshape(x,(1,24))
        feed_dict= {dnc.tf_test_dataset: x}
        predictions = sess.run(test_output, feed_dict=feed_dict)
        print(predictions)

我每次都有这个错误:

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [6,24]
     [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[6,24], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

在我的图表中,我将tf_test_dataset作为占位符的大小(1,24),但错误要求我提供训练数据的占位符。请帮助!

0 个答案:

没有答案