#[repr(u32)]pub enum DimName {
Batch = 0,
Height = 1,
Width = 2,
NumClasses = 3,
NumFeatures = 4,
NumBoxes = 5,
NumProtos = 6,
NumAnchorsXFeatures = 7,
Padding = 8,
BoxCoords = 9,
NumQueries = 11,
Unknown = 10,
}Expand description
A named tensor axis. The code is the one the C EF_DIM_NAME_*
enumerators and the Python DimName enum use.
Variants§
Batch = 0
Height = 1
Width = 2
NumClasses = 3
NumFeatures = 4
NumBoxes = 5
NumProtos = 6
NumAnchorsXFeatures = 7
Padding = 8
BoxCoords = 9
NumQueries = 11
Query axis of mask-classification outputs (class_logits,
mask_logits).
Unknown = 10
Any axis name the HAL does not recognise (e.g. a producer’s
channels on the input dshape). Preserved so the dshape length still
matches the shape and the axis sorts to the canonical tail in
swap_axes_if_needed, but it never satisfies a required-dimension
check. Keeps metadata parsing tolerant of unknown axis names instead
of failing the whole decoder build.
Implementations§
Source§impl DimName
impl DimName
Sourcepub const fn code(self) -> u32
pub const fn code(self) -> u32
The shared code for this variant. Identical on every surface.
const, deliberately: a downstream binding that cannot
write Variant = OtherEnum::Variant.code() in a #[pyclass]
discriminant position (PyO3 requires a literal there) can
still pin that literal to this value with a
const _: () = assert!(...) – a build-time check instead
of a hand-synced comment. See PyTensorMemory/PyPixelFormat
in crates/python-common/src/tensor.rs for the consumer.
Sourcepub fn from_code(code: u32) -> Option<Self>
pub fn from_code(code: u32) -> Option<Self>
Reject an unknown code rather than guessing at one.
Sourcepub fn from_str_code(s: &str) -> Option<Self>
pub fn from_str_code(s: &str) -> Option<Self>
Reject an unknown string rather than guessing at one.
Trait Implementations§
impl Copy for DimName
Source§impl<'de> Deserialize<'de> for DimName
impl<'de> Deserialize<'de> for DimName
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>,
impl Eq for DimName
impl StructuralPartialEq for DimName
Auto Trait Implementations§
impl Freeze for DimName
impl RefUnwindSafe for DimName
impl Send for DimName
impl Sync for DimName
impl Unpin for DimName
impl UnsafeUnpin for DimName
impl UnwindSafe for DimName
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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