pub struct SparseDist {
pub ids: Vec<u32>,
pub probs: Vec<f32>,
}Expand description
A distribution supported on a small candidate set, ids[j] -> probs[j]. Everything outside ids has probability zero.
Block drafters (DFlash2’s candidate selector, Medusa-style heads)
only ever expose a top-k slate, and a target sampler with top-k /
top-p applied is likewise sparse. Carrying [n, vocab] dense rows
for those is ~150k floats per position of pure waste, so the
sparse path exists alongside speculative_accept rather than
forcing callers to densify.
Duplicate ids are summed on lookup, so a caller may push the same id twice without corrupting the mass.
Fields§
§ids: Vec<u32>§probs: Vec<f32>Implementations§
Trait Implementations§
Source§impl Clone for SparseDist
impl Clone for SparseDist
Source§impl Debug for SparseDist
impl Debug for SparseDist
Auto Trait Implementations§
impl Freeze for SparseDist
impl RefUnwindSafe for SparseDist
impl Send for SparseDist
impl Sync for SparseDist
impl Unpin for SparseDist
impl UnsafeUnpin for SparseDist
impl UnwindSafe for SparseDist
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> 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