Support work.result() to get result tensors for allreduce for Gloo, NCCL backends (#43386)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43386
Resolves #43178
ghstack-source-id: 111109716
Test Plan: Added checks to existing unit test and ran it on gpu devserver.
Reviewed By: rohan-varma
Differential Revision: D23216393
fbshipit-source-id: fed5e37fbabbd2ac4a9055b20057fffe3c416c0b