How large are the tensors and how did you define index_tensor?
I’m not sure, if your inplace assignment would work as you wish, since you could reassign some values, which would be needed in other steps:
# unrolled
input[2] = input[1]
input[3] = input[2] # this values was reassigned in the previous step