Let's say I have defined a dataset in this way:
filename_dataset = tf.data.Dataset.list_files("{}/*.png".format(dataset))
how can I get the number of elements that are inside the dataset (hence, the number of single elements that compose an epoch)?
I know that tf.data.Dataset
already knows the dimension of the dataset, because the repeat()
method allows repeating the input pipeline for a specified number of epochs. So it must be a way to get this information.
len(list(dataset))
works in eager mode, although that's obviously not a good general solution.