#[repr(C)]pub struct DLDevice {
pub device_type: u32,
pub device_id: i32,
}Expand description
A device descriptor specifying where tensor data resides.
This corresponds to DLDevice in the DLPack specification.
Fields§
§device_type: u32The device type (CPU, CUDA, etc.)
device_id: i32The device ID (e.g., which GPU for multi-GPU systems)
Implementations§
Source§impl DLDevice
impl DLDevice
Sourcepub fn new(device_type: DLDeviceType, device_id: i32) -> Self
pub fn new(device_type: DLDeviceType, device_id: i32) -> Self
Create a new device descriptor.
Sourcepub fn device_type_enum(&self) -> Option<DLDeviceType>
pub fn device_type_enum(&self) -> Option<DLDeviceType>
Get the device type as an enum.
Returns None for unknown device types.
Sourcepub fn is_cuda_host(&self) -> bool
pub fn is_cuda_host(&self) -> bool
Check if this is CUDA host (pinned) memory.
Trait Implementations§
impl Copy for DLDevice
impl Eq for DLDevice
impl StructuralPartialEq for DLDevice
Auto Trait Implementations§
impl Freeze for DLDevice
impl RefUnwindSafe for DLDevice
impl Send for DLDevice
impl Sync for DLDevice
impl Unpin for DLDevice
impl UnwindSafe for DLDevice
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