mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Simplify the pattern matching logic in the cuda backend.
This commit is contained in:
@ -9,11 +9,11 @@ pub enum Storage {
|
||||
}
|
||||
|
||||
impl Storage {
|
||||
pub fn try_clone(&self) -> Result<Self> {
|
||||
pub fn try_clone(&self, layout: &Layout) -> Result<Self> {
|
||||
match self {
|
||||
Self::Cpu(storage) => Ok(Self::Cpu(storage.clone())),
|
||||
Self::Cuda(storage) => {
|
||||
let storage = storage.try_clone()?;
|
||||
let storage = storage.try_clone(layout)?;
|
||||
Ok(Self::Cuda(storage))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user