pub enum MemoryLayout {
RowMajor,
ColMajor,
Nhwc,
Nchw,
}Expand description
Memory layout for tensor data.
Different NPU hardware expects tensors in specific memory formats. This annotation allows the compiler to insert layout conversions only when necessary.
Variants§
RowMajor
Row-major (C-style) — last dimension varies fastest.
ColMajor
Column-major (Fortran-style) — first dimension varies fastest.
Nhwc
Channels-last: (N, H, W, C) — used by TFLite, Arm Ethos.
Nchw
Channels-first: (N, C, H, W) — used by ONNX, Intel NPU.
Implementations§
Trait Implementations§
Source§impl Clone for MemoryLayout
impl Clone for MemoryLayout
Source§fn clone(&self) -> MemoryLayout
fn clone(&self) -> MemoryLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MemoryLayout
Source§impl Debug for MemoryLayout
impl Debug for MemoryLayout
impl Eq for MemoryLayout
Source§impl Hash for MemoryLayout
impl Hash for MemoryLayout
Source§impl PartialEq for MemoryLayout
impl PartialEq for MemoryLayout
impl StructuralPartialEq for MemoryLayout
Auto Trait Implementations§
impl Freeze for MemoryLayout
impl RefUnwindSafe for MemoryLayout
impl Send for MemoryLayout
impl Sync for MemoryLayout
impl Unpin for MemoryLayout
impl UnsafeUnpin for MemoryLayout
impl UnwindSafe for MemoryLayout
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