Skip to main content

softmax

Function softmax 

Source
pub fn softmax(x: &mut [f64])
Expand description

Softmax in place: softmax(x)_i = e^{x_i} / Σ_j e^{x_j}, computed in the numerically stable shifted form e^{x_i − max} / Σ e^{x_j − max}. After the call x sums to 1 (a probability distribution). A length-0 slice is left unchanged.