Match NumPy by considering NaNs to be larger than any number when sorting (#15886)
Summary:
Fixes #15764
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15886
Differential Revision: D13612971
Pulled By: umanwizard
fbshipit-source-id: 91f552a25d1fd108f2f0b10e09a0ce0364f8c21e