pub struct TensorView<'a> { /* private fields */ }Expand description
A borrowed window onto one tensor, carrying its shape.
Implementations§
Source§impl<'a> TensorView<'a>
impl<'a> TensorView<'a>
Sourcepub fn get_f32(&self, index: usize) -> Option<f32>
pub fn get_f32(&self, index: usize) -> Option<f32>
Read one element, widened to f32.
Returns None if index is past the end. This is the accessor-level widening the design
calls for: no whole-tensor f32 buffer is ever built.
Sourcepub fn copy_row_f32(&self, row: usize, out: &mut [f32]) -> bool
pub fn copy_row_f32(&self, row: usize, out: &mut [f32]) -> bool
Copy one row, widening to f32, into out.
This is the cold-row path for the 151 936 × 2048 text embedding: prefill touches only the rows its token ids name, so only those rows are ever fetched and widened. Nothing advises the whole section resident.
Returns false (writing nothing) if the row is out of range or out is the wrong length,
so a caller cannot silently consume a partially-filled buffer.
Sourcepub const fn as_ref(&self) -> TensorViewRef<'a>
pub const fn as_ref(&self) -> TensorViewRef<'a>
A shape-less reference to the same bytes.
Trait Implementations§
Source§impl<'a> Clone for TensorView<'a>
impl<'a> Clone for TensorView<'a>
Source§fn clone(&self) -> TensorView<'a>
fn clone(&self) -> TensorView<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<'a> Freeze for TensorView<'a>
impl<'a> RefUnwindSafe for TensorView<'a>
impl<'a> Send for TensorView<'a>
impl<'a> Sync for TensorView<'a>
impl<'a> Unpin for TensorView<'a>
impl<'a> UnsafeUnpin for TensorView<'a>
impl<'a> UnwindSafe for TensorView<'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