pub struct AttnStep {
pub layer: usize,
pub n_head: usize,
pub q_len: usize,
pub kv_len: usize,
pub probs: Vec<f32>,
}Expand description
One block’s attention probabilities for one decode step, read back from the device.
probs is the row-major [n_head, q_len, kv_len] tensor the model
actually attended with — captured after the softmax, not recomputed — so a
visualization built from it shows the same arithmetic that produced the
text. ops::softmax is out-of-place, so capturing it perturbs nothing.
Fields§
§layer: usize§n_head: usize§q_len: usizeQuery positions in this step: the whole prompt on prefill, 1 per decode.
kv_len: usizePast positions attended to, including the queries themselves.
probs: Vec<f32>Trait Implementations§
Auto Trait Implementations§
impl Freeze for AttnStep
impl RefUnwindSafe for AttnStep
impl Send for AttnStep
impl Sync for AttnStep
impl Unpin for AttnStep
impl UnsafeUnpin for AttnStep
impl UnwindSafe for AttnStep
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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