I also find this phenomenon. But my project is as follows:
temp_in = torch.index_select(test_input2, 1, Variable(k_in_mask))
other functions
output.index_copy(1, Variable(k_out_mask), temp_out)

And I do need to record the real runtime, is there any way to calculate the time ?
Thans so much for your reply !