NumPy allowed · plain Python earns 10 bonus points
Softmax(logits) → probability distribution
Control the sharpness of output probability distributions via temperature-scaled softmax.
Implement temperature_scaled_softmax(logits, temperature). Divide each logit by temperature. Then compute stable softmax probabilities by subtracting the maximum scaled logit before exponentiating. Return probabilities rounded to 4 decimal places. If temperature <= 0.0, raise ValueError. If logits is empty, return [].
temperature_scaled_softmax(logits: list[float], temperature: float) -> list[float]