Solved by ptrblck in post #2 
              
              
                torch.repeat_interleave should work: 
x = torch.tensor([0, 1])
print(torch.repeat_interleave(x, torch.tensor([2, 3])))
> tensor([0, 0, 1, 1, 1])