#[repr(u32)]pub enum DType {
Int8 = 1,
Uint8 = 0,
Int16 = 3,
Uint16 = 2,
Int32 = 5,
Uint32 = 4,
Float16 = 8,
Float32 = 9,
Int64 = 7,
}Expand description
Quantized or floating-point data type of a model’s logical I/O.
A subset of edgefirst_tensor::DType, numbered and named by it: the
discriminant is that enum’s code and the serialized string is its
as_str ("i8", "u8", …,
"f32"). The older spellings ("int8", "uint8", …, "float32")
are still accepted on input; see DType::from_str_code.
Variants§
Int8 = 1
Uint8 = 0
Int16 = 3
Uint16 = 2
Int32 = 5
Uint32 = 4
Float16 = 8
Float32 = 9
Int64 = 7
Class maps from an in-graph argmax (TensorFlow/TFLite exports).
Implementations§
Source§impl DType
impl DType
Sourcepub const fn code(self) -> u32
pub const fn code(self) -> u32
The shared code, identical to edgefirst_tensor::DType::code.
Sourcepub fn to_tensor_dtype(self) -> DType
pub fn to_tensor_dtype(self) -> DType
The tensor dtype with the same code.
Sourcepub fn from_tensor_dtype(dtype: DType) -> Option<Self>
pub fn from_tensor_dtype(dtype: DType) -> Option<Self>
The model I/O dtype for a tensor dtype; None for one a model’s
logical I/O does not carry (u64, f64).
Sourcepub fn from_code(code: u32) -> Option<Self>
pub fn from_code(code: u32) -> Option<Self>
Decode a shared code; None for an unknown code or a tensor dtype a
model’s logical I/O does not carry.
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The string form, identical to edgefirst_tensor::DType::as_str.
Sourcepub fn from_str_code(s: &str) -> Option<Self>
pub fn from_str_code(s: &str) -> Option<Self>
Parse the string form, also accepting the older "int8", "uint8",
…, "float32" spellings.
Sourcepub fn accepted_names() -> impl Iterator<Item = &'static str>
pub fn accepted_names() -> impl Iterator<Item = &'static str>
Every accepted input spelling, current and legacy.
Trait Implementations§
impl Copy for DType
Source§impl<'de> Deserialize<'de> for DType
impl<'de> Deserialize<'de> for DType
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for DType
impl StructuralPartialEq for DType
Auto Trait Implementations§
impl Freeze for DType
impl RefUnwindSafe for DType
impl Send for DType
impl Sync for DType
impl Unpin for DType
impl UnsafeUnpin for DType
impl UnwindSafe for DType
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