Initialize RRefs only when explicitly asked for. (#62618)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62618
ShardedTensor implicitly initialized RRefs to remote shards if the
RPC framework was initialized. Although, there are use cases where the RPC
framework might be initialized for a different purpose but users would not
prefer that ShardedTensor initializes RRefs as well.
As a result, I've made RRef initialization explcitit in ShardedTensor APIs.
ghstack-source-id: 134889287
Test Plan:
1) waitforbuildbot
2) unit tests.
Reviewed By: wanchaol
Differential Revision: D30056833
fbshipit-source-id: 9b2433a38dafa1888589c5b72ed93b6f0ee51639