tf.data.Dataset: how to get the dataset size (number of elements in an epoch)? March 9, 2023 by Tarik len(list(dataset)) works in eager mode, although that’s obviously not a good general solution.