All problems
Temperature Softmax Probabilities
Problem
Sampling temperature rescales logits before softmax: p = softmax(logits / T).
Given the logits and temperature T > 0, return the probabilities computed stably.
Hint
Low temperature sharpens, high temperature flattens.
Test cases
case 1
in: [[1,2,3],1]
expected: [0.09003057317038046,0.24472847105479764,0.6652409557748218]
case 2
in: [[1,2,3],2]
expected: [0.1863237232258476,0.3071958857184984,0.506480391055654]
case 3
in: [[0,0],0.5]
expected: [0.5,0.5]
Starter codePython
def temperature_softmax_probabilities(logits, temperature):
# Your code here
pass3 test cases · run your code against them in the editor