Just try using a ragged structure:
import tensorflow as tf
import pandas as pd
df = pd.DataFrame(data={'values':[[0, 2], [0], [5, 1, 9]]})
ds = tf.data.Dataset.from_tensor_slices((tf.ragged.constant(df['values'])))
for d in ds:
print(d)
tf.Tensor([0 2], shape=(2,), dtype=int32)
tf.Tensor([0], shape=(1,), dtype=int32)
tf.Tensor([5 1 9], shape=(3,), dtype=int32)
And if you want each tensor to be the same length:
ds = tf.data.Dataset.from_tensor_slices((tf.ragged.constant(df['values']).to_tensor()))
for d in ds:
print(d)
tf.Tensor([0 2 0], shape=(3,), dtype=int32)
tf.Tensor([0 0 0], shape=(3,), dtype=int32)
tf.Tensor([5 1 9], shape=(3,), dtype=int32)