How to warp an image according to 3D location to LDR

I have a RGB picture 256 /320/ 3 and can got the pixel world location. According to the world location, I can calulate the spherical coordinates(256/320/3). Now I should warp the RGB image’s pixel to a LDR image (with missing values) which is 160/320/3. How can I implement this warp by Pytorch except for the loop method?
maybe this question can be write as:
out[ height[m,n] , width[m,n] , : ] = RGB[ m , n , : ]