pub struct CudaTensorInfo {
pub device_id: i32,
pub shape: Vec<usize>,
pub dtype: DLDataType,
pub byte_offset: u64,
pub device_type_code: i32,
}Expand description
Metadata extracted from a CUDA-resident DLPack tensor.
Accessing this struct does not copy tensor data from GPU to CPU. It records only the shape, dtype, device index, and byte offset that are safe to read from the capsule header.
Fields§
§device_id: i32Zero-based index of the CUDA device (e.g., 0 for the first GPU).
shape: Vec<usize>Tensor dimensions in row-major (C) order.
dtype: DLDataTypeDLPack element data-type descriptor.
byte_offset: u64Byte offset from the data pointer to the first element.
device_type_code: i32Raw device-type code (2 = CUDA, 10 = ROCm, etc.).
Implementations§
Source§impl CudaTensorInfo
impl CudaTensorInfo
Sourcepub fn numel(&self) -> usize
pub fn numel(&self) -> usize
Return the total number of elements (product of shape dimensions).
Sourcepub fn dtype_bits(&self) -> u8
pub fn dtype_bits(&self) -> u8
Return the element bit-width.
Sourcepub fn device_str(&self) -> String
pub fn device_str(&self) -> String
Return a human-readable device string (e.g. "cuda:0").
Trait Implementations§
Source§impl Clone for CudaTensorInfo
impl Clone for CudaTensorInfo
Source§fn clone(&self) -> CudaTensorInfo
fn clone(&self) -> CudaTensorInfo
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 moreAuto Trait Implementations§
impl Freeze for CudaTensorInfo
impl RefUnwindSafe for CudaTensorInfo
impl Send for CudaTensorInfo
impl Sync for CudaTensorInfo
impl Unpin for CudaTensorInfo
impl UnsafeUnpin for CudaTensorInfo
impl UnwindSafe for CudaTensorInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.