From d25f45990e1efe1d13feaa3e926c84e08c5b8891 Mon Sep 17 00:00:00 2001 From: Li Dong Date: Tue, 5 Mar 2024 17:50:25 +0800 Subject: [PATCH] fix sigmoid implementation bug sigmoid(x) = 1 / (1+exp(-x)) --- csrc/velox/functions/numeric_functions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csrc/velox/functions/numeric_functions.h b/csrc/velox/functions/numeric_functions.h index 3e2521008..6dbdc8501 100644 --- a/csrc/velox/functions/numeric_functions.h +++ b/csrc/velox/functions/numeric_functions.h @@ -192,7 +192,7 @@ struct sigmoid { template FOLLY_ALWAYS_INLINE bool call(TOutput& result, const TInput& x) { if (x >= 0) { - result = 1 / (1 + exp(x)); + result = 1 / (1 + exp(-x)); } else { const auto z = exp(x); result = z / (1 + z);