improve mish performance and accuracy
authorYashasSamaga <yashas_2010@yahoo.com>
Sat, 13 Jun 2020 11:23:27 +0000 (16:53 +0530)
committerYashasSamaga <yashas_2010@yahoo.com>
Sat, 13 Jun 2020 11:23:27 +0000 (16:53 +0530)
modules/dnn/src/cuda/functors.hpp

index 237c429..b0c59d6 100644 (file)
@@ -54,11 +54,8 @@ struct mish_functor<float> {
         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);