Solved by smth in post #2 
              
              
                it’s a bit more advanced usage, but you can do this efficiently on the GPU using the grid_sample method. It implements warping, given a 2D flow-field. 
http://pytorch.org/docs/0.3.0/nn.html?highlight=grid_sample#torch.nn.functional.grid_sample