logprob_of

Function logprob_of 

Source
pub fn logprob_of(
    f32_logits: &[f32],
    target: u32,
    k: usize,
) -> (f32, Vec<(u32, f32)>)
Expand description

2026-09-25: Log-softmax over f32_logits: the target token’s logprob and the top-k alternatives, highest first. k == 0 returns no alternatives. A target outside the vocab, or empty logits, gives -inf rather than a panic.