mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 02:58:50 +00:00
Move the data between the host and the device.
This commit is contained in:
@ -250,7 +250,12 @@ impl Tensor {
|
||||
let data = S::cpu_storage_as_slice(cpu_storage)?;
|
||||
Ok(self.strided_index().map(|i| data[i]).collect())
|
||||
}
|
||||
Storage::Cuda(_) => todo!(),
|
||||
Storage::Cuda(slice) => {
|
||||
// TODO: Would it be possible to only fetch the necessary data?
|
||||
let cpu_storage = slice.to_cpu_storage()?;
|
||||
let data = S::cpu_storage_as_slice(&cpu_storage)?;
|
||||
Ok(self.strided_index().map(|i| data[i]).collect())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user