Skip to main content

sample_token

Function sample_token 

Source
pub fn sample_token(logits: &[f32], opts: SampleOpts) -> usize
Expand description

Sample one token id from a [vocab] logits slice. Returns the chosen index. Stateless w.r.t. prior calls — the RNG is seeded per-call from opts.seed so repeated calls with the same seed and logits yield the same token.