diff --git a/paddle/fluid/operators/tensor_formatter.cc b/paddle/fluid/operators/tensor_formatter.cc index f1b64f042c3c0996c65c35f2741db1d30ffe6d82..a0cda54b31b4c01bb0825506a03ec67eba3cfa0b 100644 --- a/paddle/fluid/operators/tensor_formatter.cc +++ b/paddle/fluid/operators/tensor_formatter.cc @@ -119,10 +119,10 @@ void TensorFormatter::FormatData(const framework::LoDTensor& print_tensor, ? print_tensor.numel() : std::min(summarize_, print_tensor.numel()); const T* data = nullptr; + framework::LoDTensor cpu_tensor; if (is_cpu_place(print_tensor.place())) { data = print_tensor.data(); } else { - framework::LoDTensor cpu_tensor; platform::CPUPlace cpu_place; TensorCopy(print_tensor, cpu_place, &cpu_tensor); #ifdef PADDLE_WITH_ASCEND_CL