xref: /aosp_15_r20/external/pytorch/torch/csrc/distributed/rpc/script_resp.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <torch/csrc/distributed/rpc/message.h>
4 #include <torch/csrc/distributed/rpc/rpc_command_base.h>
5 #include <torch/csrc/jit/serialization/pickler.h>
6 
7 namespace torch {
8 namespace distributed {
9 namespace rpc {
10 
11 // Return value of a builtin operator or a TorchScript function.
12 class TORCH_API ScriptResp final : public RpcCommandBase {
13  public:
14   explicit ScriptResp(at::IValue&& values);
15 
16   const at::IValue& value();
17   c10::intrusive_ptr<Message> toMessageImpl() && override;
18   static std::unique_ptr<ScriptResp> fromMessage(const Message& message);
19 
20  private:
21   const at::IValue value_;
22 };
23 
24 } // namespace rpc
25 } // namespace distributed
26 } // namespace torch
27