@harryhan618 that’s a really good question.
The convention of representing the image space using [-1, 1] comes from the original 2015 paper 34 that introduced Spatial Transformer Networks (after which PyTorch’s grid_sample() and other similar functions in other ML frameworks are based).
A reasonable justification of this convention is that it allows coordinates to be specified without respect to the resolution of the underlying image. That is, the same image at different resolutions should still be sampled at the same location.
So it’s a sort of resolution-agnostic representation.
That said, I agree that there should be an option to pass in the grid in unnormalized pixel units. I’ve pushed for such an option in the past, and maybe if I have extra time at some point, I’ll go through and implement it.