Fix `torch.nn.functional.grid_sample` crashes if `grid` has NaNs (#42703)
Summary:
In `clip_coordinates` replace `minimum(maximum(in))` composition with `clamp_max(clamp_min(in))`
Swap order of `clamp_min` operands to clamp NaNs in grid to 0
Fixes https://github.com/pytorch/pytorch/issues/42616
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42703
Reviewed By: ezyang
Differential Revision: D22987447
Pulled By: malfet
fbshipit-source-id: a8a2d6de8043d6b77c8707326c5412d0250efae6