As the title says I'm trying to save a TensorSliceDataset object to file. Viewing tensorflow's 
CodePudding user response:
With Tensorflow 2.10.0, you can use tf.data.Dataset.save:
import tensorflow as tf
print(tf.__version__)
# 2.10.0
path = '/content/'
t = tf.range(10)
ds = tf.data.Dataset.from_tensor_slices(t)
tf.data.Dataset.save(ds, path)
new_ds = tf.data.Dataset.load(path)
Otherwise, use tf.data.experimental.save for older versions:
import tensorflow as tf
path = '/content/'
t = tf.range(10)
ds = tf.data.Dataset.from_tensor_slices(t)
tf.data.experimental.save(ds, path)
new_ds = tf.data.experimental.load(path)
