From 2d5f5d74991341080c6b1cf3e74305660b011252 Mon Sep 17 00:00:00 2001 From: Iwan Kawrakow Date: Mon, 4 Sep 2023 15:04:09 +0300 Subject: [PATCH] Also guard against extremely small weights --- k_quants.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k_quants.c b/k_quants.c index 446917e20..8742d4aee 100644 --- a/k_quants.c +++ b/k_quants.c @@ -83,7 +83,7 @@ static float make_qx_quants(int n, int nmax, const float * restrict x, int8_t * float ax = fabsf(x[i]); if (ax > amax) { amax = ax; max = x[i]; } } - if (!amax) { // all zero + if (amax < 1e-30f) { // all zero for (int i = 0; i < n; ++i) { L[i] = 0; }