pub struct StridePattern {
pub strides: Vec<usize>,
pub is_contiguous: bool,
pub alignment: usize,
}Expand description
Stride pattern for a tensor.
Fields§
§strides: Vec<usize>Strides for each dimension (in elements)
is_contiguous: boolWhether strides are contiguous
alignment: usizeAlignment in bytes (0 means no specific alignment)
Implementations§
Source§impl StridePattern
impl StridePattern
Sourcepub fn row_major(dims: &[usize]) -> Self
pub fn row_major(dims: &[usize]) -> Self
Create a row-major stride pattern for given dimensions.
Sourcepub fn column_major(dims: &[usize]) -> Self
pub fn column_major(dims: &[usize]) -> Self
Create a column-major stride pattern for given dimensions.
Sourcepub fn with_alignment(self, alignment: usize) -> Self
pub fn with_alignment(self, alignment: usize) -> Self
Set the alignment requirement.
Sourcepub fn is_vectorizable(&self) -> bool
pub fn is_vectorizable(&self) -> bool
Check if the stride pattern allows efficient vectorization.
Sourcepub fn access_cost(&self) -> f64
pub fn access_cost(&self) -> f64
Estimate memory access cost (lower is better).
Trait Implementations§
Source§impl Clone for StridePattern
impl Clone for StridePattern
Source§fn clone(&self) -> StridePattern
fn clone(&self) -> StridePattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StridePattern
impl Debug for StridePattern
Source§impl<'de> Deserialize<'de> for StridePattern
impl<'de> Deserialize<'de> for StridePattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StridePattern
impl PartialEq for StridePattern
Source§impl Serialize for StridePattern
impl Serialize for StridePattern
impl Eq for StridePattern
impl StructuralPartialEq for StridePattern
Auto Trait Implementations§
impl Freeze for StridePattern
impl RefUnwindSafe for StridePattern
impl Send for StridePattern
impl Sync for StridePattern
impl Unpin for StridePattern
impl UnwindSafe for StridePattern
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