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

@ -31,7 +31,7 @@ pub trait RNN {
let (_b_size, seq_len, _features) = input.dims3()?;
let mut output = Vec::with_capacity(seq_len);
for seq_index in 0..seq_len {
let input = input.i((.., seq_index, ..))?;
let input = input.i((.., seq_index, ..))?.contiguous()?;
let state = if seq_index == 0 {
self.step(&input, init_state)?
} else {