28/32
Part 6 of 6 · What interviewers ask nextLearn and do
Shifting a row's logits changes nothing in the gradient
A common follow-up: why doesn't subtracting the max change the gradient?
row = np.array([2.0, 1.0, -1.0])
for shift in [0.0, -2.0, 5.0]:
e = np.exp(row + shift)
print((e / e.sum()).round(3))
Add 0, then -2, then 5 to every logit in [2, 1, -1]. What does the softmax give?
Pick one to see what it prints.
Pick an answer above to see the rest