We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fe59c8 commit 8511b30Copy full SHA for 8511b30
kernels/portable/cpu/op_constant_pad_nd.cpp
@@ -83,6 +83,15 @@ void apply_padding_to_dim(
83
size_t copy_nbytes = copy_len * sizeof(CTYPE);
84
85
if (copy_nbytes > 0) {
86
+ // Check that out_data and self_data do not overlap.
87
+ ET_KERNEL_CHECK_MSG(
88
+ ctx,
89
+ out_data != self_data &&
90
+ ((out_data + copy_len < self_data) ||
91
+ (self_data + copy_len < out_data)),
92
+ InvalidArgument,
93
+ /* void */,
94
+ "Out tensor overlaps with the input tensor. This is not supported.");
95
memcpy(out_data, self_data, copy_nbytes);
96
out_data += copy_len;
97
self_data += copy_len;
0 commit comments