From f68345e9b12a9922b302a4f7d1db6bc29d77904b Mon Sep 17 00:00:00 2001 From: Stephan Walter Date: Sun, 26 Mar 2023 12:36:55 +0200 Subject: [PATCH] Fix softmax in perplexity.cpp --- examples/perplexity/perplexity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp index 75d526d3d..41e50be7f 100644 --- a/examples/perplexity/perplexity.cpp +++ b/examples/perplexity/perplexity.cpp @@ -9,7 +9,7 @@ std::vector softmax(const std::vector& 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; }