How to extract data/labels back from TensorFlow dataset
In case your tf.data.Dataset is batched, the following code will retrieve all the y labels: y = np.concatenate([y for x, y in ds], axis=0) Quick explanation: [y for x, y in ds] is known as “list comprehension” in python. If dataset is batched, this expression will loop thru each batch and put each batch y … Read more