Lets say i have a tensor and apply unique to it
t1 = torch.tensor([2,2,3,3,5,1,1,1])
u = t1.unique(dim=0, sorted=True, return_counts=True, return_inverse=True)
->
(tensor([1, 2, 3, 5]), tensor([1, 1, 2, 2, 3, 0, 0, 0]), tensor([3, 2, 2, 1]))
how can i map the counts back to the original tensor like to
t1 = [2,2,3,3,5,1,1,1]
t2 = [2,2,2,2,1,3,3,3]
I know how to do this with a loop, is there a faster way to do it?