mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[rpc][jit] support rpc_sync in TorchScript (#43043)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/43043 This add the support for rpc_sync in TorchScript in a way similar to rpc_async Test Plan: Imported from OSS Reviewed By: mrshenli Differential Revision: D23252039 Pulled By: wanchaol fbshipit-source-id: 8a05329cb8a24079b2863178b73087d47273914c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8bec7cfa91
commit
3e5df5f216
@ -855,11 +855,15 @@ std::shared_ptr<SugaredValue> toSugaredValue(
|
||||
obj.ptr() == py::module::import("torch.jit").attr("annotate").ptr()) {
|
||||
return SpecialFormValue::create(prim::annotate);
|
||||
#ifdef USE_DISTRIBUTED
|
||||
// RPC module is only avaialble when build flag "USE_DISTRIBUTED" is on.
|
||||
} else if (
|
||||
// RPC module is only avaialble when build flag "USE_DISTRIBUTED" is on.
|
||||
obj.ptr() ==
|
||||
py::module::import("torch.distributed.rpc").attr("rpc_async").ptr()) {
|
||||
return SpecialFormValue::create(prim::rpc_async);
|
||||
} else if (
|
||||
obj.ptr() ==
|
||||
py::module::import("torch.distributed.rpc").attr("rpc_sync").ptr()) {
|
||||
return SpecialFormValue::create(prim::rpc_sync);
|
||||
#endif
|
||||
} else if (auto callee = as_module(obj)) {
|
||||
throw ErrorReport(loc) << "Cannot call a ScriptModule that is not"
|
||||
|
Reference in New Issue
Block a user