Torch.nn.functional.grid_sample takes any value for mode

When I call:

torch.nn.functional.grid_sample(array_5d, indices, mode='anything')

mode can be anything. Why is that? Is there no mode to choose?

I would like to choose mode=‘trilinear’, is that available? In the docs I can see there is mode=‘bilinear’ as default.

Only bilinear is supported:

But the code should really throw an error if you try to pass anything other than bilinear. I’ve opened an issue here: for this.

1 Like