Assume we have a Tensor like this 7927, 4, 7984, 45, 185, 55, 7876, 6, 172, 7898 and in your collate_fn you want to convert this to,
7927
7927, 4
7927, 4, 7984
7927, 4, 7984, 45
7927, 4, 7984, 45, 185
7927, 4, 7984, 45, 185, 55....

Is there something inbuilt which can do this, i don’t actually want to loop over to create it as i have around 3-4 tensors like that which have to undergo a similar thing.
Thanks a lot for your time.