Fix softmax in perplexity.cpp

This commit is contained in:
Stephan Walter 2023-03-26 12:36:55 +02:00 committed by Georgi Gerganov
parent 3a42193b3d
commit f68345e9b1
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -9,7 +9,7 @@ std::vector<double> softmax(const std::vector<float>& logits) {
for (size_t i = 0; i < logits.size(); i++) {
// Subtract the maximum logit value from the current logit value for numerical stability
float logit = logits[i] - max_logit;
double exp_logit = std::exp(logit);
double exp_logit = std::exp((double)logit);
sum_exp += exp_logit;
probs[i] = exp_logit;
}