I'm using TensorFlow to load the MNIST dataset, and it keeps printing "Cleanup called..." on the output cell continuously.
And this also happens when I start the training.
I am using tf version 2.6.4
Code:
train_ds, test_ds = tfds.load(
'mnist',
split=['train', 'test'],
as_supervised=True
)
def normalize_img(image, label):
return tf.cast(image, tf.float32) / 255., label
train_ds = train_ds.map(normalize_img, num_parallel_calls=tf.data.AUTOTUNE)
train_ds = train_ds.shuffle(len(train_ds))
train_ds = train_ds.batch(128)
train_ds = train_ds.prefetch(tf.data.AUTOTUNE)
next(iter(train_ds))
Output:
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
Cleanup called...
...
I've already looked at this and this question. But the only solution there is to downgrade TensorFlow, which I do not want to do.
How can I properly load the data so that this message never appears?