[c10d] Prefer use of torch_check (#63928)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63928
throw std::invalid_argument results in not getting stacktraces with
TORCH_SHOW_CPP_STACKTRACES=1, so instead prefer torch_check here.
ghstack-source-id: 137135328
Test Plan: CI
Reviewed By: mrshenli
Differential Revision: D30533955
fbshipit-source-id: 33e5bf4f449e3043dec68da93f8022f6624d9675