[RPC Framework] Support passing RemoteModule as an arg (#57695)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57695
Add pickling/unpickling support for `RemoteModule`.
#Closes: https://github.com/pytorch/pytorch/issues/57516
ghstack-source-id: 128472946
Test Plan:
buck test mode/dev-nosan caffe2/test/distributed/rpc:process_group_agent -- test_send_remote_module_over_the_wire
buck test mode/dev-nosan caffe2/test/distributed/rpc:process_group_agent -- test_send_remote_module_with_a_new_attribute_over_the_wire
buck test mode/dev-nosan caffe2/test/distributed/rpc:process_group_agent -- RemoteModule
Reviewed By: rohan-varma
Differential Revision: D28233108
fbshipit-source-id: 94eea2251fa53fb71912457c80d0a1e44504fc85