What is the opposite of torch.unique_consecutive?
How can I efficiently revert torch.unique_consecutive? I.e.:
x = torch.tensor([1, 1, 2, 2, 3, 1, 1, 2])
output, counts = torch.unique_consecutive(x, return_counts=True)



y = torch.SOMETHING(output,counts) #y equals x


Please use torch.repeat_interleave(**args) for your task
x = torch.tensor([1, 1, 2, 2, 3, 1, 1, 2])
output, counts = torch.unique_consecutive(x, return_counts=True)
y = torch.repeat_interleave(output, counts)
#&gt;&gt;y = [1, 1, 2, 2, 3, 1, 1, 2]

