summaryrefslogtreecommitdiff
path: root/ggml-quants.c
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2024-05-19 17:08:46 +0200
committerGitHub <noreply@github.com>2024-05-19 17:08:46 +0200
commite4e6f67be6a8a697f5f89a28c98934e53c99c359 (patch)
tree1e2b4211737d800ab426a68438842b6456b20a97 /ggml-quants.c
parent5ca49cbecda27ce0a7266658fc3b640bff3ed386 (diff)
ggml : fix another case of quants nans (#7387)
Diffstat (limited to 'ggml-quants.c')
-rw-r--r--ggml-quants.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ggml-quants.c b/ggml-quants.c
index 7008e5d8..ff105986 100644
--- a/ggml-quants.c
+++ b/ggml-quants.c
@@ -1149,7 +1149,7 @@ static float make_qx_quants(int n, int nmax, const float * restrict x, int8_t *
sumlx += w*x[i]*l;
suml2 += w*l*l;
}
- float scale = sumlx/suml2;
+ float scale = suml2 ? sumlx/suml2 : 0.0f;
if (return_early) return suml2 > 0 ? 0.5f*(scale + 1/iscale) : 1/iscale;
float best = scale * sumlx;
for (int is = -9; is <= 9; ++is) {