fix (slice): add guard for area out of range

This commit is contained in:
panzezhong 2023-12-28 16:16:06 +08:00
parent e5ca66db66
commit a91ed84354
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ __global__ void _pad_slice_kernel(void *part, void *whole,
} else { } else {
((T *)whole)[tid] = ((T *)part)[offset]; ((T *)whole)[tid] = ((T *)part)[offset];
} }
} else { } else if (offset >= 0) {
((T *)part)[offset] = ((T *)whole)[tid]; ((T *)part)[offset] = ((T *)whole)[tid];
} }
tid += stride; tid += stride;