fix: make sure `sorter` indices are inbound in `searchsorted` (#94863)
Fixes #91606
Add a checker to `sorter` to make sure indices are inbound (as NumPy).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94863
Approved by: https://github.com/Skylion007, https://github.com/malfet