As a workaround you could perform the repetition in a loop:
new_a = []
for a_, size in zip(a, [4,3,4,5]):
    new_a.append(a_.repeat(size))
new_a = torch.cat(new_a)

This might not be as performant as your code but will save some memory for the indices.