mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30915 Since we now have C++14, we don't need these c10::guts helpers anymore ghstack-source-id: 95777609 Test Plan: waitforsandcastle Differential Revision: D18869639 fbshipit-source-id: 97716f932297c64c6e814410ac47b444c33d4e2e
38 lines
893 B
C++
38 lines
893 B
C++
#include <torch/csrc/distributed/rpc/python_call.h>
|
|
|
|
#include <c10/util/C++17.h>
|
|
|
|
namespace torch {
|
|
namespace distributed {
|
|
namespace rpc {
|
|
|
|
PythonCall::PythonCall(
|
|
std::vector<char> pickledPayload,
|
|
std::vector<torch::Tensor> tensors)
|
|
: pickledPayload_(std::move(pickledPayload)),
|
|
tensors_(std::move(tensors)) {}
|
|
|
|
Message PythonCall::toMessage() && {
|
|
return Message(
|
|
std::move(pickledPayload_),
|
|
std::move(tensors_),
|
|
MessageType::PYTHON_CALL);
|
|
}
|
|
|
|
std::unique_ptr<PythonCall> PythonCall::fromMessage(const Message& message) {
|
|
return std::make_unique<PythonCall>(
|
|
message.payload(), message.tensors());
|
|
}
|
|
|
|
const std::vector<char>& PythonCall::pickledPayload() const {
|
|
return pickledPayload_;
|
|
}
|
|
|
|
const std::vector<torch::Tensor>& PythonCall::tensors() const {
|
|
return tensors_;
|
|
}
|
|
|
|
} // namespace rpc
|
|
} // namespace distributed
|
|
} // namespace torch
|