I have a ragged tensor of shape (72, None, 16) that I am to pad to (72, Max_length, 16) based on the max length of on the 1st axis.
How do i store the original length (72, None) of the ragged tensor along axis 1 so that I can use it to recover back the ragged tensor from the padded tensor
Hi @blessedg, One way to do is, let say i have a ragged tensor of shape [2, None, 3] created using
import numpy as np
x1 = np.asarray([1,0,0])
x2 = np.asarray([0,1,0])
x3 = np.asarray([0,0,1])
ac = tf.RaggedTensor.from_row_splits(
values=[x1, x2, x3],
row_splits=[0, 2, 3])
After that i have converted the ragged tensor to tensor using
a = ac.to_tensor(shape=[2, None, 3])
and then removed the last dimension using tf.unstack
tf.unstack(a,axis=2)[0].shape
Thank You.