#[non_exhaustive]pub enum ElementType {
Show 16 variants
Pred,
S8,
S16,
S32,
S64,
U8,
U16,
U32,
U64,
F16,
BF16,
F32,
F64,
C64,
C128,
Other(u32),
}Expand description
The element type of a Buffer.
This covers the types ruxla uses. Buffers of other types (for example
4-bit or 8-bit floating point) are reported as ElementType::Other.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Pred
Boolean (pred in XLA), stored as one byte.
S8
Signed 8-bit integer.
S16
Signed 16-bit integer.
S32
Signed 32-bit integer.
S64
Signed 64-bit integer.
U8
Unsigned 8-bit integer.
U16
Unsigned 16-bit integer.
U32
Unsigned 32-bit integer.
U64
Unsigned 64-bit integer.
F16
IEEE 754 half precision.
BF16
bfloat16.
F32
IEEE 754 single precision.
F64
IEEE 754 double precision.
C64
Complex number made of two F32s.
C128
Complex number made of two F64s.
Other(u32)
A type this crate does not know, with its raw PJRT_Buffer_Type value.
Implementations§
Source§impl ElementType
impl ElementType
Sourcepub fn size_in_bytes(self) -> Option<usize>
pub fn size_in_bytes(self) -> Option<usize>
Returns the size of one element in bytes, or None for
ElementType::Other.
Sourcepub fn from_dtype(dtype: DType) -> Self
pub fn from_dtype(dtype: DType) -> Self
Returns the element type of a ruxla dtype.
Trait Implementations§
Source§impl Clone for ElementType
impl Clone for ElementType
impl Copy for ElementType
Source§impl Debug for ElementType
impl Debug for ElementType
impl Eq for ElementType
Source§impl Hash for ElementType
impl Hash for ElementType
Source§impl PartialEq for ElementType
impl PartialEq for ElementType
impl StructuralPartialEq for ElementType
Auto Trait Implementations§
impl Freeze for ElementType
impl RefUnwindSafe for ElementType
impl Send for ElementType
impl Sync for ElementType
impl Unpin for ElementType
impl UnsafeUnpin for ElementType
impl UnwindSafe for ElementType
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