Solved by ptrblck in post #2 
              
              
                I think you are hitting multiple issues. 
The first one seems to be the “double indexing” which doesn’t assign the values to the original tensor. 
Index new_x and the assignment should work: 
new_x[idx, j] = obj_x[i]

However, even though new_x would contain values now, it seems that enumerate(..., …