diff --git a/onnxruntime/core/providers/cpu/math/softmax_shared.cc b/onnxruntime/core/providers/cpu/math/softmax_shared.cc index 8ee6ec79c2..7dd3a10cfc 100644 --- a/onnxruntime/core/providers/cpu/math/softmax_shared.cc +++ b/onnxruntime/core/providers/cpu/math/softmax_shared.cc @@ -25,6 +25,7 @@ #pragma warning(disable : 4996) #endif #include +#include #ifdef _MSC_VER #pragma warning(pop) #endif @@ -79,7 +80,7 @@ common::Status SoftmaxCPU(const int64_t N, } } else { for (int i = 0; i < N; ++i) { - auto log_fmaxf_scale_i = log(fmaxf(scale[i], 1e-20f)); + auto log_fmaxf_scale_i = std::log(fmaxf(scale[i], 1e-20f)); for (int j = 0; j < D; ++j) { Ydata[i * D + j] = Xdata[i * D + j] - rowmax[i] - log_fmaxf_scale_i; } diff --git a/onnxruntime/core/providers/cpu/rnn/rnn_activation_functors.h b/onnxruntime/core/providers/cpu/rnn/rnn_activation_functors.h index 8f2be9d1cf..f7724746dd 100644 --- a/onnxruntime/core/providers/cpu/rnn/rnn_activation_functors.h +++ b/onnxruntime/core/providers/cpu/rnn/rnn_activation_functors.h @@ -39,9 +39,8 @@ template inline T Sigmoid(T x, T alpha RNN_UNUSED_PARAMETER, T beta RNN_UNUSED_PARAMETER) { if (x >= 0) { return 1 / (1 + exp(-x)); - } else { - return exp(x) / (1 + exp(x)); } + return exp(x) / (1 + exp(x)); } template @@ -69,7 +68,7 @@ inline T Softsign(T x, T alpha, T beta); template <> inline float Softsign(float x, float alpha ORT_ATTRIBUTE_UNUSED, float beta ORT_ATTRIBUTE_UNUSED) { - return x / (1 + fabs(x)); + return x / (1 + std::fabs(x)); } template <>