Remove the second copy on calling dist_autograd_context._known_worker_ids() (#31206)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31206
Improvement on #25525.
- DistAutogradContext::getKnownWorkerIds() returns a unordered_map as temp value. No need to copy this temp value A into another temp value B.
ghstack-source-id: 95736296
Test Plan:
# Unit tests
```
buck test mode/dev-nosan //caffe2/test:dist_autograd_fork -- test_worker_ids_recorded
```
```
buck test mode/dev-nosan //caffe2/test:dist_autograd_fork_thrift -- test_context_cleanup_tensor_with_grad
```
Differential Revision: D5707771
fbshipit-source-id: 9fea83dc69b02047aef8b02a73028a260ac0be40