pub struct MockTensor { /* private fields */ }Expand description
A mock tensor that stores shape and optional f32 data. No GPU, no Candle — pure Rust.
Implementations§
Trait Implementations§
Source§impl Clone for MockTensor
impl Clone for MockTensor
Source§fn clone(&self) -> MockTensor
fn clone(&self) -> MockTensor
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 moreSource§impl Debug for MockTensor
impl Debug for MockTensor
Source§impl TensorLike for MockTensor
impl TensorLike for MockTensor
Source§fn is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Check if tensor is contiguous in memory
Source§fn view(&self, start: &[usize], end: &[usize]) -> Result<TensorRef>
fn view(&self, start: &[usize], end: &[usize]) -> Result<TensorRef>
Create a view/slice of this tensor
Source§fn reshape(&self, shape: &[usize]) -> Result<TensorRef>
fn reshape(&self, shape: &[usize]) -> Result<TensorRef>
Reshape tensor to new shape (must have same number of elements)
Source§fn to_vec_f32(&self) -> Result<Vec<f32>>
fn to_vec_f32(&self) -> Result<Vec<f32>>
Extract tensor data as Vec (for logits sampling)
This is a convenience method for backends that need to extract data
Source§fn to_vec_u32(&self) -> Result<Vec<u32>>
fn to_vec_u32(&self) -> Result<Vec<u32>>
Extract tensor data as Vec (for token IDs)
This is a convenience method for backends that need to extract token data
Source§fn argmax_last_dim_u32(&self) -> Result<u32>
fn argmax_last_dim_u32(&self) -> Result<u32>
Fast path: argmax over the last dimension, returning the selected token id. Read more
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Get size in bytes for this tensor
Auto Trait Implementations§
impl Freeze for MockTensor
impl RefUnwindSafe for MockTensor
impl Send for MockTensor
impl Sync for MockTensor
impl Unpin for MockTensor
impl UnsafeUnpin for MockTensor
impl UnwindSafe for MockTensor
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