I see no other option than iterating through your entire dataset.
ds = tf.data.experimental.make_csv_dataset('myfile.csv', batch_size=16, num_epochs=1)
for ix, _ in enumerate(ds, 1):
pass
print('The total number of steps is', ix)
Don't forget the num_epochs
argument.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…