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 calling a Python function over RPC. 9 class TORCH_API PythonCall final : public RpcCommandBase { 10 public: 11 PythonCall(SerializedPyObj&& serializedPyObj, bool isAsyncExecution); 12 13 c10::intrusive_ptr<Message> toMessageImpl() && override; 14 15 static std::unique_ptr<PythonCall> fromMessage(const Message& message); 16 17 const SerializedPyObj& serializedPyObj() const; 18 isAsyncExecution()19 inline bool isAsyncExecution() const { 20 return isAsyncExecution_; 21 } 22 23 private: 24 SerializedPyObj serializedPyObj_; 25 const bool isAsyncExecution_; 26 }; 27 28 } // namespace torch::distributed::rpc 29