Convert a one-dimensional vector of logits into probabilities with the softmax function, computed stably by subtracting the maximum first.
Implement solve(x).
Returns. Return a float NumPy vector of the same length whose entries are positive and sum to 1.
Example 1
Input:
solve([1, 2, 3])
Output:
[0.090031, 0.244728, 0.665241]
Example 2
Input:
solve([0, 0])
Output:
[0.5, 0.5]
Example 3
Input:
solve([1000.0, 1000.0, 999.0])
Output:
[0.422319, 0.422319, 0.155362]
No results yet
Run your code to check it against the examples, or submit to run every test.