Convert tensor defined on a non-uniform mesh grid to tensor on uniform mesh grid

Dear all,

I’m having difficulty converting a tensor defined on a non-uniform mesh grid to a tensor on a uniform grid. My problem can be illustrated using the following picture:

I want to convert a tensor created from results on a very fine non-uniform mesh to a coarse uniform mesh, then take the converted tensor as input to a neural network, and get the result with the same size with the input. Then convert back the output tensor to the original fine non-uniform mesh.

I understand I can use grid_sample to convert a tensor defined on a uniform mesh to non-uniform mesh. But is there a viable way for the vice versa?

Any suggestions would be greatly appreciated!