未验证 提交 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()) { SetTensorFromPyArray(
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
SetTensorFromPyArray( value,
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()), self->tensor.place(),
value, false);
platform::Place(platform::CUDAPlace(0)),
false);
#else
SetTensorFromPyArray(
static_cast<phi::DenseTensor*>(value_tensor_tmp.impl().get()),
value,
platform::Place(platform::CPUPlace()),
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.
先完成此消息的编辑!
想要评论请 注册