Randomly Shuffle a Tensor (Eager or Ragged) along any dimension

I wish to shuffle a ragged tensor along it’s innermost dimension, is there a function which can help me do this? I could only spot tf.random.shuffle but this doesn’t work for ragged tensors and doesn’t take custom dimensions

Hi @Aflah ,

tf.random.shuffle doesn’t work directly with ragged tensors or allow shuffling along specific dimensions. However, we can create a custom function to shuffle a ragged tensor along its innermost dimension.

Here’s an approach You Can Refer this Colab Notebook,

Thank You .