pub struct CapturedTensor {
pub name: String,
pub layer: Option<usize>,
pub ne0: usize,
pub ne1: usize,
pub data: Vec<f32>,
}Expand description
A single tensor copied out of the decode graph.
Produced by TensorCapture after a successful crate::LlamaContext::decode.
For layer outputs ("l_out-N"), Self::layer is set to N.
Fields§
§name: StringGraph node name (e.g. "l_out-13", "result_norm").
layer: Option<usize>Layer index when name is "l_out-{N}", otherwise None.
ne0: usizeFirst dimension (typically n_embd / hidden size).
ne1: usizeSecond dimension (typically number of tokens in the batch position).
data: Vec<f32>Flattened ne0 * ne1 values in ggml row-major order.
Index as data[token_idx * ne0 + dim_idx].
Implementations§
Source§impl CapturedTensor
impl CapturedTensor
Sourcepub fn token_embedding(&self, token_idx: usize) -> Option<&[f32]>
pub fn token_embedding(&self, token_idx: usize) -> Option<&[f32]>
Hidden-state vector for one token index.
Returns None when token_idx >= n_tokens().
Trait Implementations§
Source§impl Clone for CapturedTensor
impl Clone for CapturedTensor
Source§fn clone(&self) -> CapturedTensor
fn clone(&self) -> CapturedTensor
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 Freeze for CapturedTensor
impl RefUnwindSafe for CapturedTensor
impl Send for CapturedTensor
impl Sync for CapturedTensor
impl Unpin for CapturedTensor
impl UnsafeUnpin for CapturedTensor
impl UnwindSafe for CapturedTensor
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