How to perform grid_sample with 5-D shapes of grid?


Here is the case,

grid.shape = [num, batch, height, width, 2] 
feature.shape = [num, batch, c, height, width]

Now, I want to use grid_sample for each grid and its corresponding feature (in terms of dimension 0), but grid_sample only support 4-D grid as input. So how can I perform grid_sample in above case while avoiding to use loop?

Thanks in advance!