mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
fix overflow
This commit is contained in:
@@ -680,7 +680,14 @@ struct SigmoidFunctor : public BaseDefaultFunctor<SigmoidFunctor>
|
||||
|
||||
inline float calculate(float x) const
|
||||
{
|
||||
return 1.f / (1.f + exp(-x));
|
||||
float y;
|
||||
if (x >= 0)
|
||||
y = 1.f / (1.f + exp(-x));
|
||||
else {
|
||||
y = exp(x);
|
||||
y = y / (1 + y);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
#ifdef HAVE_HALIDE
|
||||
|
||||
Reference in New Issue
Block a user