Skip to content

Commit 76bcf45

Browse files
【stride】 fix set_value stride_copy condition (#74341)
* update copy and set_value support stride input/output * fix dsttensor is nullptr * fix dst holder is nullptr * delete sted::cout * fix set_value
1 parent a12e0ff commit 76bcf45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

paddle/fluid/pybind/eager_method.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,8 @@ static PyObject* tensor_method_set_underline_tensor(TensorObject* self,
14141414
if (self->tensor.is_dense_tensor()) {
14151415
auto* dst_tensor =
14161416
static_cast<phi::DenseTensor*>(self->tensor.impl().get());
1417-
if (!dst_tensor->meta().is_contiguous() ||
1417+
if (self->tensor.has_allocation() &&
1418+
!dst_tensor->meta().is_contiguous() ||
14181419
!src_tensor->meta().is_contiguous()) {
14191420
VLOG(8) << "set_tensor() method , src or dst tensor is not contiguous";
14201421
if (!FLAGS_use_stride_kernel) {

0 commit comments

Comments
 (0)