Extract the values of a tensor along an arbitrary line

Hello,

I’m looking for a pytorch tool for interpolating tensor along a given line (batch of lines)

.

I suppose grid_sample could do the work.