Modernize make pointers (#61741)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/61741

Test Plan: Sandcastle

Reviewed By: malfet

Differential Revision: D29717385

fbshipit-source-id: 4452b77981e49175f744bdaab12cd225bf75b90e
This commit is contained in:
Richard Barnes 2021-07-22 15:38:22 -07:00 committed by Facebook GitHub Bot
parent f98fa5ea13
commit a91be24e2d
4 changed files with 6 additions and 10 deletions

View File

@ -1206,8 +1206,7 @@ auto Engine::start_device_threads() -> void {
// types), and pre-allocate the device_ready_queues_ to ensure safe reading on it.
device_ready_queues_ = std::vector<std::shared_ptr<ReadyQueue>>(num_devices);
for (auto& queue : device_ready_queues_) {
// NOLINTNEXTLINE(modernize-make-shared)
queue.reset(new ReadyQueue());
queue = std::make_shared<ReadyQueue>();
}
thread_pool_shared_ = std::make_shared<ThreadPoolShared>();

View File

@ -80,9 +80,8 @@ std::unique_ptr<PropagateGradientsReq> PropagateGradientsReq::fromMessage(
grads[i] = tupleElements[i].toTensor();
}
// NOLINTNEXTLINE(modernize-make-unique)
return std::unique_ptr<PropagateGradientsReq>(
new PropagateGradientsReq(autogradMetadata, grads, retainGraph));
return std::make_unique<PropagateGradientsReq>(
autogradMetadata, grads, retainGraph);
}
const AutogradMetadata& PropagateGradientsReq::getAutogradMetadata() {

View File

@ -333,9 +333,8 @@ void BytecodeDeserializer::parseMethods(
? at::optional<IValue>{m_tuple[2]}
: at::nullopt;
// NOLINTNEXTLINE(modernize-make-unique)
auto function = std::unique_ptr<mobile::Function>(
new mobile::Function(c10::QualifiedName(function_name)));
auto function =
std::make_unique<mobile::Function>(c10::QualifiedName(function_name));
const auto& ins_list =
expect_field(codeTable, "instructions", BYTECODE_INDEX_INSTRUCTION)

View File

@ -103,8 +103,7 @@ int main(int argc, char *argv[]) {
std::string tempfile = tempdir->name + "/manager.sock";
// NOLINTNEXTLINE(modernize-make-unique)
srv_socket.reset(new ManagerServerSocket(tempfile));
srv_socket = std::make_unique<ManagerServerSocket>(tempfile);
register_fd(srv_socket->socket_fd);
print_init_message(tempfile.c_str());
DEBUG("opened socket %s", tempfile.c_str());