Relationship between interpolate and grid_sample

We have been using grid_sample at work to sample images (and other data types) between known values. This seems like the equivalent of upsampling.

I’ve tested that when I direct the grid sample to the scaled (x, y) locations of known values, I get back the known values. This is good.

For a new task, I need to actually upsample some data on a grid. There are associated spatial coordinates for each “pixel” value in our data. The horizontal and vertical delta between spatial coordinates is not equal, and we need it to be. It seems that functional.interpolate has the utility we need.

However, interpolate does not preserve the original values like grid_sample does. It decreases large values by a large percent (20-30%). This is undesirable for us.

One co-worker has suggested that we implement our own version of interpolation using grid_sample. I’m wondering

  • about any pit falls to this idea
  • is the dilution of large values when using interpolate expected behavior?