Fix kthvalue error for scalar input (#47600)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47600
fixes https://github.com/pytorch/pytorch/issues/30818
Note that the median case was already fixed by https://github.com/pytorch/pytorch/pull/45847
Test Plan: Imported from OSS
Reviewed By: malfet
Differential Revision: D24860337
Pulled By: heitorschueroff
fbshipit-source-id: 69ccbbb6c7c86671e5712b1c2056c012d898b4f2