Does the equivalent Python code uses torch.nn.functional.grid_sample? We can look at this for how to map it to the equivalent C++ code: https://github.com/pytorch/pytorch/blob/4baadd54d7c28eac0a2fa07686d593a376e6bd5f/test/cpp/api/functional.cpp#L440-L502 71.