Struct candle_core::shape::Shape
source · pub struct Shape(/* private fields */);
Implementations§
source§impl Shape
impl Shape
pub fn from_dims(dims: &[usize]) -> Self
sourcepub fn rank(&self) -> usize
pub fn rank(&self) -> usize
The rank is the number of dimensions, 0 for a scalar value, 1 for a vector, etc.
pub fn into_dims(self) -> Vec<usize>
sourcepub fn elem_count(&self) -> usize
pub fn elem_count(&self) -> usize
The total number of elements, this is the product of all dimension sizes.
sourcepub fn is_contiguous(&self, stride: &[usize]) -> bool
pub fn is_contiguous(&self, stride: &[usize]) -> bool
Returns true if the strides are C contiguous (aka row major).
sourcepub fn is_fortran_contiguous(&self, stride: &[usize]) -> bool
pub fn is_fortran_contiguous(&self, stride: &[usize]) -> bool
Returns true if the strides are Fortran contiguous (aka column major).
Trait Implementations§
source§impl PartialEq for Shape
impl PartialEq for Shape
impl Eq for Shape
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.