Skip to content

Commit adc63ad

Browse files
committed
Fix softmax in perplexity.cpp
1 parent 57e2a89 commit adc63ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/perplexity/perplexity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ std::vector<double> softmax(const std::vector<float>& logits) {
99
for (size_t i = 0; i < logits.size(); i++) {
1010
// Subtract the maximum logit value from the current logit value for numerical stability
1111
float logit = logits[i] - max_logit;
12-
double exp_logit = std::exp(logit);
12+
double exp_logit = std::exp((double)logit);
1313
sum_exp += exp_logit;
1414
probs[i] = exp_logit;
1515
}

0 commit comments

Comments
 (0)