提交 1491934d 编写于 作者: D Dmitry Kurtaev

Optimize Mish for CPU backend

上级 fce486c4
......@@ -667,8 +667,11 @@ struct MishFunctor : public BaseFunctor
{
for( int i = 0; i < len; i++ )
{
// Use fast approximation introduced in https://github.com/opencv/opencv/pull/17200
float x = srcptr[i];
dstptr[i] = x * tanh(log(1.0f + exp(x)));
float eX = exp(std::min(x, 20.f));
float n = (eX + 2) * eX;
dstptr[i] = (x * n) / (n + 2);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册