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

fix slice bug (#47349) (#47376)

修改一处Slice的bug
上级 0369cd0f
......@@ -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<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
platform::Place(platform::CUDAPlace(0)),
false);
#else
SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
platform::Place(platform::CPUPlace()),
self->tensor.place(),
false);
#endif
} else {
SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
value_tensor_tmp.place(),
false);
}
value_tensor = value_tensor_tmp;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册