Error:tensorflow.python.framework.errors_impl.DataLossError: truncated record at 40109222 [Op:IteratorGetNextSync]
There are three aspects that may raise this error:
1.It is main due to the incomplete data.
2.A result of several reading of the same record, and its also dependent on the disk
3.The tf.data.experimental.ignore_errors
transformation could be a solution for the rare corruption that happens during the training.
import tensorflow as tf
dataset = tf.data.Dataset.range(10)
dataset = dataset.apply(tf.data.experimental.ignore_errors())
iterator = dataset.make_one_shot_iterator()
next_element = iterator.get_next()
with tf.Session() as sess:
while True:
print(sess.run(next_element))
Reference:
https://github.com/tensorflow/tensorflow/issues/13463
https://github.com/tensorflow/tensorflow/issues/25700#issuecomment-462959084