Skip to content

Commit 2db5f25

Browse files
committed
use the make_shared replace the shared_ptr
1 parent 4d1fbd0 commit 2db5f25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

paddle/fluid/pybind/imperative.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,10 +1909,10 @@ void BindImperative(py::module *m_ptr) {
19091909
reinterpret_cast<void *>(data_ptr), 0);
19101910

19111911
// Reset the memory with device pointer
1912-
std::shared_ptr<memory::allocation::Allocation> holder(
1913-
new memory::allocation::Allocation(
1912+
std::shared_ptr<memory::allocation::Allocation> holder =
1913+
std::make_shared<memory::allocation::Allocation>(
19141914
cuda_device_pointer, need_allocate_size,
1915-
platform::CUDAPlace(device_id)));
1915+
platform::CUDAPlace(device_id));
19161916
self_tensor->ResetHolderWithType(holder, self_tensor->type());
19171917
},
19181918
py::arg("device_id") = 0, py::return_value_policy::reference, R"DOC(

0 commit comments

Comments
 (0)