pub struct PthTensor<'a> {
pub name: String,
pub shape: Vec<usize>,
pub dtype: PthDtype,
pub data: Cow<'a, [u8]>,
}Expand description
A single tensor view from a parsed .pth file.
Borrows raw data from the memory-mapped file (zero-copy for contiguous little-endian tensors) or owns a copy (non-contiguous / big-endian).
Fields§
§name: StringTensor name (state_dict key, e.g. "linear.weight").
shape: Vec<usize>Tensor shape (e.g. [16, 10] for a 16-by-10 matrix).
dtype: PthDtypeElement data type.
data: Cow<'a, [u8]>Raw bytes in row-major, native-endian order.
Cow::Borrowed when the tensor data is contiguous and little-endian
(zero-copy slice from the mmap). Cow::Owned when a layout
transformation was required (non-contiguous strides or
big-endian byte-swap).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PthTensor<'a>
impl<'a> RefUnwindSafe for PthTensor<'a>
impl<'a> Send for PthTensor<'a>
impl<'a> Sync for PthTensor<'a>
impl<'a> Unpin for PthTensor<'a>
impl<'a> UnsafeUnpin for PthTensor<'a>
impl<'a> UnwindSafe for PthTensor<'a>
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