Skip to content

Commit e4e6f67

Browse files
authored
ggml : fix another case of quants nans (#7387)
1 parent 5ca49cb commit e4e6f67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml-quants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ static float make_qx_quants(int n, int nmax, const float * restrict x, int8_t *
11491149
sumlx += w*x[i]*l;
11501150
suml2 += w*l*l;
11511151
}
1152-
float scale = sumlx/suml2;
1152+
float scale = suml2 ? sumlx/suml2 : 0.0f;
11531153
if (return_early) return suml2 > 0 ? 0.5f*(scale + 1/iscale) : 1/iscale;
11541154
float best = scale * sumlx;
11551155
for (int is = -9; is <= 9; ++is) {

0 commit comments

Comments
 (0)