mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Bugfix for the contiguous strides.
This commit is contained in:
@ -25,6 +25,16 @@ impl<S: crate::WithDType> NdArray for S {
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: crate::WithDType, const N: usize> NdArray for &[S; N] {
|
||||
fn shape(&self) -> Result<Shape> {
|
||||
Ok(Shape::from(self.len()))
|
||||
}
|
||||
|
||||
fn to_cpu_storage(&self) -> CpuStorage {
|
||||
S::to_cpu_storage(self.as_slice())
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: crate::WithDType> NdArray for &[S] {
|
||||
fn shape(&self) -> Result<Shape> {
|
||||
Ok(Shape::from(self.len()))
|
||||
@ -35,6 +45,16 @@ impl<S: crate::WithDType> NdArray for &[S] {
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: crate::WithDType, const N: usize, const M: usize> NdArray for &[[S; N]; M] {
|
||||
fn shape(&self) -> Result<Shape> {
|
||||
Ok(Shape::from((M, N)))
|
||||
}
|
||||
|
||||
fn to_cpu_storage(&self) -> CpuStorage {
|
||||
S::to_cpu_storage_owned(self.concat())
|
||||
}
|
||||
}
|
||||
|
||||
impl Device {
|
||||
pub(crate) fn zeros(&self, shape: &Shape, dtype: DType) -> Storage {
|
||||
match self {
|
||||
|
Reference in New Issue
Block a user