gpt4 book ai didi

python - TensorFlow estimator.predict() 给出警告 :tensorflow:Input graph does not contain a QueueRunner

转载 作者:太空狗 更新时间:2023-10-29 21:04:49 25 4
gpt4 key购买 nike

我正在尝试使用带有 estimator.predict 的自定义输入函数进行预测,但它给了我这个:

警告:tensorflow:输入图不包含 QueueRunner。这意味着永远预测 yield 。这可能是一个错误。

它没有给我一个错误,但是 predict 只是说它恢复参数并且不返回实际的预测。这是我的代码:

test_data = [0.03, 0.91, 0.95, 0.10, 0.56, 0.93]
test_data_in = { k: test_data[index] for index, k in enumerate(FEATURES) }
print(test_data_in)

def predict_input_fn(data_set):
feature_cols = { k: tf.reshape(tf.constant(data_set[k], dtype=tf.float32), [-1]) for k in FEATURES }
return feature_cols

predictions = estimator.predict(input_fn=lambda: predict_input_fn(test_data_in))
print(list(predictions))

我看过this问题,但我找不到与我的问题相关的解决方案。为什么 TensorFlow 会显示此警告,我该如何摆脱它?

最佳答案

我也点击了这个,阅读线程 https://github.com/tensorflow/tensorflow/issues/11621

I think your program is perfectly correct and it's the warning that's wrong :). It was added long before the Datasets API existed, and was well intentioned. (AFAICT the predict() API relies on your input terminating with a tf.errors.OutOfRangeError and before Datasets existed only QueueRunner-based pipelines would terminate that way, so it probably was an error if no queue runners existed.) @xiejw Should we remove this warning, or is there a more cunning way to detect the error condition?

希望他们能在不必要时消除错误。

关于python - TensorFlow estimator.predict() 给出警告 :tensorflow:Input graph does not contain a QueueRunner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46857382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com