2
我不能讓下面的string_input_producer- hello world
程序運行:tensorflow.string_input_producer「世界你好」
import tensorflow as tf
filename = tf.placeholder(dtype=tf.string, name='filename')
f_q = tf.train.string_input_producer(filename, num_epochs=1, shuffle=False)
filename_tf = f_q.dequeue()
with tf.Session() as S:
S.run(tf.local_variables_initializer())
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
print(S.run(filename_tf, feed_dict={filename: "hello world"}))
coord.request_stop()
coord.join(threads)
似乎很簡單,但TF告訴我,我需要傳遞一個字符串的錯誤信息值佔位符'文件名'(我這樣做)。任何人在這裏得到什麼我做錯了?謝謝
爲什麼說卡紙,沒有卡紙!
[他們](https://www.tensorflow.org/api_docs/python/tf/train/string_input_producer)表示'tf.train.string_input_producer'可以在API 1.3中使用張量。我怎樣才能做到這一點? – Jus
'tf.train.string_input_producer(tf.convert_to_tensor(a_list_of_strings))',也許這就是你想要的? – Seven
謝謝@seven;是的,這將是我給出的最小例子的另一種解決方案。然而,在我的用例中,我真的很想將'tf.placeholder'傳遞到稍後填充的'tf.string_input_producer'中,就像我無法工作的例子一樣。這種方法對我的用例會有一些優點。 – Jus