pub struct CandleTensor { /* private fields */ }Expand description
Candle tensor wrapper
Implementations§
Trait Implementations§
Source§impl Debug for CandleTensor
impl Debug for CandleTensor
Source§impl TensorLike for CandleTensor
impl TensorLike for CandleTensor
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 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 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 is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Check if tensor is contiguous in memory
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 CandleTensor
impl !RefUnwindSafe for CandleTensor
impl Send for CandleTensor
impl Sync for CandleTensor
impl Unpin for CandleTensor
impl UnsafeUnpin for CandleTensor
impl !UnwindSafe for CandleTensor
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more