pub struct VntkResult {
pub tokens: Vec<u32>,
pub next_nodes: Vec<u32>,
pub valid: Vec<bool>,
pub dense_masks: Vec<bool>,
pub branch_size: usize,
}Expand description
Output of a single VNTK call covering all beams at one decoding step.
Index arithmetic:
tokens[i * branch_size + j]— j-th token candidate for beam inext_nodes[i * branch_size + j]— trie node reached by that tokenvalid[i * branch_size + j]— whether slot j is a real childdense_masks[i * vocab_size + tok]— O(1) membership test for beam i
Fields§
§tokens: Vec<u32>Token IDs: shape [n × branch_size], invalid slots hold 0.
next_nodes: Vec<u32>Next-node IDs: shape [n × branch_size], invalid slots hold 0.
valid: Vec<bool>Validity flags: shape [n × branch_size].
dense_masks: Vec<bool>Dense boolean mask: shape [n × vocab_size].
branch_size: usizeB_t: the padded branch-factor used at this level.
Implementations§
Source§impl VntkResult
impl VntkResult
Sourcepub fn children_for(&self, i: usize) -> impl Iterator<Item = (u32, u32)> + '_
pub fn children_for(&self, i: usize) -> impl Iterator<Item = (u32, u32)> + '_
Returns the valid (token, next_node) pairs for beam i.
Sourcepub fn mask_for(&self, i: usize, vocab_size: usize) -> &[bool]
pub fn mask_for(&self, i: usize, vocab_size: usize) -> &[bool]
Returns the dense mask slice for beam i (length = vocab_size).
Sourcepub fn global_mask(&self, vocab_size: usize) -> Vec<bool>
pub fn global_mask(&self, vocab_size: usize) -> Vec<bool>
Collapses all per-beam dense masks into a single OR-reduced mask of
length vocab_size. Used when all beams in a batch share one logit
vector (single-query inference).
Trait Implementations§
Source§impl Clone for VntkResult
impl Clone for VntkResult
Source§fn clone(&self) -> VntkResult
fn clone(&self) -> VntkResult
Returns a duplicate of the value. Read more
1.0.0 · 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 VntkResult
impl RefUnwindSafe for VntkResult
impl Send for VntkResult
impl Sync for VntkResult
impl Unpin for VntkResult
impl UnsafeUnpin for VntkResult
impl UnwindSafe for VntkResult
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