From 170ac721b643bbffec0afa10aadec8a895fab0f0 Mon Sep 17 00:00:00 2001 From: Kexin Zhao Date: Thu, 3 May 2018 20:23:07 -0700 Subject: [PATCH] remove unnecessary tensor copy in save op --- paddle/fluid/operators/load_op.cc | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/paddle/fluid/operators/load_op.cc b/paddle/fluid/operators/load_op.cc index 6ffe0bec5e3..c6bd2bf3dfc 100644 --- a/paddle/fluid/operators/load_op.cc +++ b/paddle/fluid/operators/load_op.cc @@ -46,19 +46,6 @@ class LoadOp : public framework::OperatorBase { auto *tensor = out_var->GetMutable(); DeserializeFromStream(fin, tensor, *dev_ctx); - - if (platform::is_gpu_place(place)) { - // copy CPU to GPU - framework::LoDTensor cpu_tensor; - cpu_tensor.ShareDataWith(*tensor); - cpu_tensor.set_lod(tensor->lod()); - - // reset tensor - out_var->Clear(); - tensor = out_var->GetMutable(); - tensor->set_lod(cpu_tensor.lod()); - TensorCopy(cpu_tensor, place, *dev_ctx, tensor); - } } }; -- GitLab