Skip to main content

softmax

Function softmax 

Source
pub fn softmax(logits: &[f64]) -> Vec<f64>
Expand description

Compute softmax with the log-sum-exp trick for numerical stability.

Returns a probability vector that sums to 1.0 (unless the input is empty).