How to extract data/labels back from TensorFlow dataset
问题 there are plenty of examples how to create and use TensorFlow datasets, e.g. dataset = tf.data.Dataset.from_tensor_slices((images, labels)) My question is how to get back the data/labels from the TF dataset in numpy form? In other words want would be reverse operation of the line above, i.e. I have a TF dataset and want to get back images and labels from it. 回答1: Supposing our tf.data.Dataset is called train_dataset , with eager_execution on, you can retrieve images and labels like this: for