Iterating over a Dataset TF 2.0 with for loop
问题 This problem is about how to iterate over a TF Dataset given that make_initializable_iterator() is deprecated. I read a data set with the function below: def read_dataset_new(filename, target='delay'): ds = tf.data.TFRecordDataset(filename) ds = ds.map(lambda buf: parse(buf, target=target)) ds = ds.batch(1) return ds Then I want to iterate over the data set. I have been using: https://www.tensorflow.org/api_docs/python/tf/data/Dataset#make_initializable_iterator with tf.compat.v1.Session() as