#[repr(C)]pub struct DLDataType {
pub code: u8,
pub bits: u8,
pub lanes: u16,
}Expand description
Data type descriptor specifying the element type of a tensor.
This corresponds to DLDataType in the DLPack specification.
Fields§
§code: u8Type code (signed int, unsigned int, float, etc.)
bits: u8Number of bits per element (e.g., 32 for float32)
lanes: u16Number of lanes for vectorized types (usually 1)
Implementations§
Source§impl DLDataType
impl DLDataType
Sourcepub fn new(code: DLDataTypeCode, bits: u8, lanes: u16) -> Self
pub fn new(code: DLDataTypeCode, bits: u8, lanes: u16) -> Self
Create a new data type descriptor.
Sourcepub fn code_enum(&self) -> Option<DLDataTypeCode>
pub fn code_enum(&self) -> Option<DLDataTypeCode>
Get the type code as an enum.
Returns None for unknown type codes.
Trait Implementations§
Source§impl Clone for DLDataType
impl Clone for DLDataType
Source§fn clone(&self) -> DLDataType
fn clone(&self) -> DLDataType
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 DLDataType
impl Debug for DLDataType
Source§impl Hash for DLDataType
impl Hash for DLDataType
Source§impl PartialEq for DLDataType
impl PartialEq for DLDataType
impl Copy for DLDataType
impl Eq for DLDataType
impl StructuralPartialEq for DLDataType
Auto Trait Implementations§
impl Freeze for DLDataType
impl RefUnwindSafe for DLDataType
impl Send for DLDataType
impl Sync for DLDataType
impl Unpin for DLDataType
impl UnwindSafe for DLDataType
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