probly.utils.torch.temperature_softmax¶
- probly.utils.torch.temperature_softmax(logits: Tensor, temperature: float | Tensor) Tensor[source]¶
Compute the softmax of logits with temperature scaling applied.
Computes the softmax based on the logits divided by the temperature. Assumes that the last dimension of logits is the class dimension.
- Parameters:
logits – Logits to apply softmax on of shape (n_instances, n_classes).
temperature – Temperature scaling factor.
- Returns:
Softmax of logits with temperature scaling applied of shape (n_instances, n_classes).