logprob_of

Function logprob_of 

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

Log-softmax over f32_logits; returns the target token’s logprob and the top-k alternatives sorted descending by logprob. k=0 returns an empty top vector (chosen-token logprob only). A target outside the vocab yields -inf (fail-visible, never panics).