Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Jan 3, 2025
1 parent 50848e0 commit b378b19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/layer/reduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,10 @@ static int reduction_op(const Mat& a, Mat& b, bool reduce_w, bool reduce_h, bool
#pragma omp parallel for num_threads(opt.num_threads)
for (int i = 0; i < size; i++)
{
// math optimization will probably generate rsqrt
// that produce -inf on sse with subnormal input
// flush subnormal input to zero as a workaround
// TODO explicit use simd sqrt like unaryop --- nihui
b[i] = sqrtf(b[i] < FLT_MIN ? 0.f : b[i]);
}
}
Expand Down

0 comments on commit b378b19

Please sign in to comment.