pub enum DType {
Show 15 variants
Bool,
Int8,
Int16,
Int32,
Int64,
UInt8,
UInt16,
UInt32,
UInt64,
Float16,
Float32,
Float64,
BFloat16,
Complex64,
Complex128,
}Expand description
Tensor element types (data types).
These represent the unboxed element types that can be stored in tensors. Each dtype has known size and alignment.
Variants§
Bool
Boolean (1 byte).
Int8
8-bit signed integer.
Int16
16-bit signed integer.
Int32
32-bit signed integer.
Int64
64-bit signed integer.
UInt8
8-bit unsigned integer.
UInt16
16-bit unsigned integer.
UInt32
32-bit unsigned integer.
UInt64
64-bit unsigned integer.
Float16
16-bit floating point (half precision).
Float32
32-bit floating point (single precision).
Float64
64-bit floating point (double precision).
BFloat16
Brain floating point (bfloat16).
Complex64
Complex number (single precision).
Complex128
Complex number (double precision).
Implementations§
Source§impl DType
impl DType
Sourcepub const fn size_bytes(self) -> usize
pub const fn size_bytes(self) -> usize
Returns the size in bytes of this dtype.
Sourcepub const fn is_integer(self) -> bool
pub const fn is_integer(self) -> bool
Returns true if this is an integer type.
Trait Implementations§
impl Copy for DType
Source§impl<'de> Deserialize<'de> for DType
impl<'de> Deserialize<'de> for DType
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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more