Struct candle_core::layout::Layout
source · pub struct Layout { /* private fields */ }
Implementations§
source§impl Layout
impl Layout
pub fn new(shape: Shape, stride: Vec<usize>, start_offset: usize) -> Self
pub fn contiguous_with_offset<S: Into<Shape>>( shape: S, start_offset: usize ) -> Self
pub fn contiguous<S: Into<Shape>>(shape: S) -> Self
pub fn dims(&self) -> &[usize]
pub fn shape(&self) -> &Shape
pub fn stride(&self) -> &[usize]
pub fn start_offset(&self) -> usize
sourcepub fn contiguous_offsets(&self) -> Option<(usize, usize)>
pub fn contiguous_offsets(&self) -> Option<(usize, usize)>
Returns the appropriate start and stop offset if the data is stored in a C contiguous (aka row major) way.
sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Returns true if the data is stored in a C contiguous (aka row major) way. Note that this does not implies that the start offset is 0 or that there are no extra elements at the end of the storage.
sourcepub fn is_fortran_contiguous(&self) -> bool
pub fn is_fortran_contiguous(&self) -> bool
Returns true if the data is stored in a Fortran contiguous (aka column major) way.
pub fn narrow(&self, dim: usize, start: usize, len: usize) -> Result<Self>
pub fn transpose(&self, dim1: usize, dim2: usize) -> Result<Self>
pub fn permute(&self, idxs: &[usize]) -> Result<Self>
pub fn broadcast_as<S: Into<Shape>>(&self, shape: S) -> Result<Self>
Trait Implementations§
source§impl PartialEq for Layout
impl PartialEq for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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.