From 99cec1a6e83b30ed284cde4423816411461eb801 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Thu, 27 Oct 2022 15:03:27 +0800 Subject: [PATCH] fix slice bug (#47349) (#47376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改一处Slice的bug --- paddle/fluid/pybind/eager_method.cc | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/paddle/fluid/pybind/eager_method.cc b/paddle/fluid/pybind/eager_method.cc index 8649f88d48..74c66bfb0a 100644 --- a/paddle/fluid/pybind/eager_method.cc +++ b/paddle/fluid/pybind/eager_method.cc @@ -1104,27 +1104,11 @@ static PyObject* tensor_method__setitem_eager_tensor(TensorObject* self, "please check the type of tensor.")); } - if (!value_tensor_tmp.initialized()) { -#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) - SetTensorFromPyArray( - static_cast(value_tensor_tmp.impl().get()), - value, - platform::Place(platform::CUDAPlace(0)), - false); -#else - SetTensorFromPyArray( - static_cast(value_tensor_tmp.impl().get()), - value, - platform::Place(platform::CPUPlace()), - false); -#endif - } else { - SetTensorFromPyArray( - static_cast(value_tensor_tmp.impl().get()), - value, - value_tensor_tmp.place(), - false); - } + SetTensorFromPyArray( + static_cast(value_tensor_tmp.impl().get()), + value, + self->tensor.place(), + false); value_tensor = value_tensor_tmp; } else { -- GitLab