Skip to content

Commit 583b68d

Browse files
authored
[XPU] fix strided_copy data_size param (#74225)
1 parent f6b1c15 commit 583b68d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

paddle/phi/kernels/xpu/strided_copy_kernel.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ void StridedCopyKernel(const Context& dev_ctx,
7070
r = xpu::copy<XPUType>(dev_ctx.x_context(), input_data, output_data, 1);
7171
PADDLE_ENFORCE_XDNN_SUCCESS(r, "copy");
7272
} else {
73-
int64_t data_size = input.Holder()->size() - input.meta().offset;
73+
int64_t data_size_in = input.Holder()->size() - input.meta().offset;
74+
int64_t data_size_out = out->Holder()->size() - out->meta().offset;
75+
int64_t data_size = std::max(data_size_in, data_size_out);
7476
r = xpu::strided_copy<XPUType>(dev_ctx.x_context(),
7577
input_data,
7678
output_data,

0 commit comments

Comments
 (0)