softmax

Function softmax 

Source
pub fn softmax(values: &[f32]) -> AttentionResult<Vec<f32>>
Expand description

Computes softmax over a slice of values.

Uses the numerically stable variant: softmax(x) = exp(x - max(x)) / sum(exp(x - max(x)))

§Arguments

  • values - Input values

§Returns

Softmax-normalized values