ggml-quants : avoid division by zero in make_q3_quants

This commit is contained in:
Francis Couture-Harpin
2025-08-17 18:26:02 -04:00
parent 184cdc6b27
commit fb573f4440

View File

@@ -566,7 +566,7 @@ static float make_q3_quants(int n, int nmax, const float * GGML_RESTRICT x, int8
for (int i = 0; i < n; ++i) {
L[i] += nmax;
}
return sumlx / suml2;
return suml2 > 0.0f ? sumlx / suml2 : 0.0f;
}
for (int i = 0; i < n; ++i) {
int l = nearest_int(iscale * x[i]);