Hi,
The problem is that the two following lines:
temp_in = torch.index_select(test_input2, 1, Variable(k_in_mask))
# and
output.index_copy(1, Variable(k_out_mask), temp_out)

Add some noise to the runtime computation.
If you put them outside of the loop, the runtime goes back to the same thing.
If you replace them with other ops line temp_in = temp_in + 1, you will see the same noise.