Convert a list of real numbers (logits) into a **probability distribution**.
softmax(xᵢ) = exp(xᵢ) / Σ exp(xⱼ)- All outputs are in (0, 1)
- All outputs sum to exactly 1.0
- **Shift invariant**: softmax(x) == softmax(x + c)
Input: [1.0, 2.0, 3.0] Output: [0.09003, 0.24473, 0.66524]
- 1 ≤ len(logits) ≤ 100
- Round each value to **5 decimal places**
Similar Problems
Test Cases (2 visible · 2 hidden)
Case 1: Basic 3-element
Input: softmax([1.0, 2.0, 3.0])
Expected: [0.09003, 0.24473, 0.66524]
Case 2: Uniform
Input: softmax([0.0, 0.0, 0.0])
Expected: [0.33333, 0.33333, 0.33333]
⌘↵ Run · ⌘⇧↵ Submit