未验证 提交 f7616d71 编写于 作者: W wanghuancoder 提交者: GitHub

fix slice bug (#47349)

上级 c98af923
...@@ -1169,27 +1169,11 @@ static PyObject* tensor_method__setitem_eager_tensor(TensorObject* self, ...@@ -1169,27 +1169,11 @@ static PyObject* tensor_method__setitem_eager_tensor(TensorObject* self,
"please check the type of tensor.")); "please check the type of tensor."));
} }
if (!value_tensor_tmp.initialized()) {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
platform::Place(platform::CUDAPlace(0)),
false);
#else
SetTensorFromPyArray( SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()), static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value, value,
platform::Place(platform::CPUPlace()), self->tensor.place(),
false); false);
#endif
} else {
SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
value_tensor_tmp.place(),
false);
}
value_tensor = value_tensor_tmp; value_tensor = value_tensor_tmp;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册