Relax the contiguous check for cuda kernels. (#2000)

* Relax the contiguous check for cuda kernels.

* Ensure contiguity for RNNs.

* Unrelated fix for segment anything.

* Better error message + allow concatenating empty slices.
This commit is contained in:
Laurent Mazare
2024-04-03 09:02:38 +02:00
committed by GitHub
parent 2be1a35710
commit 318d143224
4 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,7 @@ __device__ bool is_contiguous(
size_t acc = 1;
for (unsigned int d = 0; d < num_dims; d++) {
unsigned int dim_idx = num_dims - 1 - d;
if (acc != strides[dim_idx]) {
if (dims[dim_idx] > 1 && acc != strides[dim_idx]) {
return false;
}
acc *= dims[dim_idx];