pub enum DataLayout {
NCHW,
NHWC,
NCDHW,
NDHWC,
NCL,
NLC,
Auto,
}Expand description
Supported data layouts for tensors
Variants§
NCHW
Channels first: [N, C, H, W] - Optimal for GPU/CUDA
NHWC
Channels last: [N, H, W, C] - Optimal for CPU/NEON
NCDHW
Channels first for 3D: [N, C, D, H, W]
NDHWC
Channels last for 3D: [N, D, H, W, C]
NCL
Channels first for 1D: [N, C, L]
NLC
Channels last for 1D: [N, L, C]
Auto
Auto-detect optimal layout based on device and operation
Implementations§
Source§impl DataLayout
impl DataLayout
Sourcepub fn channel_axis(&self) -> usize
pub fn channel_axis(&self) -> usize
Get channel axis for this layout
Sourcepub fn is_channels_first(&self) -> bool
pub fn is_channels_first(&self) -> bool
Check if this is a channels-first layout
Sourcepub fn to_permutation(&self, target: DataLayout) -> Option<Vec<usize>>
pub fn to_permutation(&self, target: DataLayout) -> Option<Vec<usize>>
Get the permutation indices to convert from this layout to target layout
Trait Implementations§
Source§impl Clone for DataLayout
impl Clone for DataLayout
Source§fn clone(&self) -> DataLayout
fn clone(&self) -> DataLayout
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 DataLayout
impl Debug for DataLayout
Source§impl Hash for DataLayout
impl Hash for DataLayout
Source§impl PartialEq for DataLayout
impl PartialEq for DataLayout
impl Copy for DataLayout
impl Eq for DataLayout
impl StructuralPartialEq for DataLayout
Auto Trait Implementations§
impl Freeze for DataLayout
impl RefUnwindSafe for DataLayout
impl Send for DataLayout
impl Sync for DataLayout
impl Unpin for DataLayout
impl UnsafeUnpin for DataLayout
impl UnwindSafe for DataLayout
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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