pub enum Layout {
NCHW,
NHWC,
NCHWc {
block: u8,
},
}Expand description
Memory-layout tag describing how Conv-shaped tensors are laid out.
NCHW is ONNX’s native layout and the default. NHWC is what yscv’s CPU runner currently uses internally for Conv hot paths. NCHWc packs channels into SIMD-sized blocks (8 for AVX2/NEON, 16 for AVX-512), which lets 3×3 non-depthwise Conv use direct SIMD loads over the C-block stride rather than paying tail-handling cost.
The tag is metadata — it does not change how data() / shape()
are interpreted by Tensor itself. Consumers (conv kernels, layout
transformers) read the tag to pick the right kernel dispatch.
Shape ordering matches the layout: NCHW tensors have shape
[N, C, H, W], NHWC [N, H, W, C], NCHWc [N, C/block, H, W, block]
(5-D). Data is always contiguous in its declared ordering.
Variants§
NCHW
ONNX default: [N, C, H, W].
NHWC
Channels-last: [N, H, W, C]. Used by yscv’s CPU conv paths.
NCHWc
Blocked channels-first: [N, C/block, H, W, block]. block is a
SIMD-lane-aligned chunk size (8 on AVX2/NEON, 16 on AVX-512).
Trait Implementations§
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Forget for Layout
impl Freeze for Layout
impl Move for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more