Skip to content

Commit fb573f4

Browse files
committed
ggml-quants : avoid division by zero in make_q3_quants
1 parent 184cdc6 commit fb573f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml-quants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static float make_q3_quants(int n, int nmax, const float * GGML_RESTRICT x, int8
566566
for (int i = 0; i < n; ++i) {
567567
L[i] += nmax;
568568
}
569-
return sumlx / suml2;
569+
return suml2 > 0.0f ? sumlx / suml2 : 0.0f;
570570
}
571571
for (int i = 0; i < n; ++i) {
572572
int l = nearest_int(iscale * x[i]);

0 commit comments

Comments
 (0)