Fix float overflow problem in softmax exponentiation.