From 87ab4ee56732d4b6eeacf586f33deb0cfe95c0ea Mon Sep 17 00:00:00 2001 From: YashasSamaga Date: Sat, 13 Jun 2020 16:53:27 +0530 Subject: [PATCH] improve mish performance and accuracy --- modules/dnn/src/cuda/functors.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/dnn/src/cuda/functors.hpp b/modules/dnn/src/cuda/functors.hpp index 237c429558..b0c59d6684 100644 --- a/modules/dnn/src/cuda/functors.hpp +++ b/modules/dnn/src/cuda/functors.hpp @@ -54,11 +54,8 @@ struct mish_functor { using csl::device::fast_exp; auto e = fast_exp(value); - if (value <= -18.0f) - return value * e; - auto n = e * e + 2 * e; - if (value <= -5.0f) + if (value <= -0.6f) return value * fast_divide(n, n + 2); return value - 2 * fast_divide(value, n + 2);