How can I use tf.data Datasets in eager execution mode?
make_one_shot_iterator()
should work in TensorFlow 1.8, but for now (i.e., for TensorFlow 1.7), do the following:
import tensorflow.contrib.eager as tfe
dataset = tf.data.Dataset.from_tensor_slices(tf.random_uniform([50, 10]))
dataset = dataset.batch(5)
for batch in tfe.Iterator(dataset):
print(batch)
With TF 2.1,
You can create an iterator like so:
iterator = iter(dataset)
And get the next batch of values:
batch = iterator.get_next()