xref: /aosp_15_r20/external/pytorch/torch/csrc/distributed/rpc/python_resp.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <torch/csrc/distributed/rpc/rpc_command_base.h>
4 #include <torch/csrc/distributed/rpc/types.h>
5 
6 namespace torch::distributed::rpc {
7 
8 // RPC call representing the response of a Python UDF over RPC.
9 class TORCH_API PythonResp final : public RpcCommandBase {
10  public:
11   explicit PythonResp(SerializedPyObj&& serializedPyObj);
12 
13   c10::intrusive_ptr<Message> toMessageImpl() && override;
14 
15   static std::unique_ptr<PythonResp> fromMessage(const Message& message);
16 
17   const SerializedPyObj& serializedPyObj() const;
18 
19  private:
20   SerializedPyObj serializedPyObj_;
21 };
22 
23 } // namespace torch::distributed::rpc
24