我正试图从教程中tensorflow中生成的数据集中读取5行https://www.tensorflow.org/tutorials/load_data/text,但我被堆叠在一个无限循环中
这是读取数据集的for循环
for ex in all_labeled_data.take(5):
print(ex)
这是无限重复的结果:
(<tf.Tensor 'IteratorGetNext_1:0' shape=() dtype=string>, <tf.Tensor 'IteratorGetNext_1:1' shape=() dtype=int64>)
(<tf.Tensor 'IteratorGetNext_2:0' shape=() dtype=string>, <tf.Tensor 'IteratorGetNext_2:1' shape=() dtype=int64>)
(<tf.Tensor 'IteratorGetNext_3:0' shape=() dtype=string>, <tf.Tensor 'IteratorGetNext_3:1' shape=() dtype=int64>)
....
(<tf.Tensor 'IteratorGetNext_3:0' shape=() dtype=string>, <tf.Tensor 'IteratorGetNext_3:1' shape=() dtype=int64>)
你能告诉我怎么了吗?我使用的是Tensorflow 1.14.0版
感谢
使用最新版本的Tensorflow v2.0即可工作。