Skip to content

Commit

Permalink
improve mish performance and accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
YashasSamaga committed Jun 13, 2020
1 parent 6fbf704 commit 87ab4ee
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions modules/dnn/src/cuda/functors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 87ab4ee

Please sign in to comment.