Why grid_sample over direct indexing?

I’ve seen F.grid_sample be used to sample points in a predicted depth map in depth-supervised gaussian splatting; I’m wondering why we would use grid_sample over plain direct-indexing i.e. depth_map[sample_idxs_tuple]. What’s the motivation behind grid_sample?