Skip to content

Commit 0e36739

Browse files
authored
save partial imatrix
1 parent 9635529 commit 0e36739

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/imatrix/imatrix.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ void IMatrixCollector::save_imatrix(int ncall) const {
250250
}
251251

252252
if (n_zeros > 0) {
253-
fprintf(stderr, "%s: entry '%40s' has partial data (%.2f%%) - skipping\n", __func__, kv.first.c_str(), 100.0f * (n_all - n_zeros) / n_all);
254-
continue;
253+
fprintf(stderr, "%s: entry '%40s' has partial data (%.2f%%)\n", __func__, kv.first.c_str(), 100.0f * (n_all - n_zeros) / n_all);
255254
}
256255

257256
n_entries++;
@@ -275,7 +274,7 @@ void IMatrixCollector::save_imatrix(int ncall) const {
275274
if (nval > 0) {
276275
std::vector<float> tmp(nval);
277276
for (int i = 0; i < nval; i++) {
278-
tmp[i] = (stat.values[i] / static_cast<float>(stat.counts[i])) * static_cast<float>(stat.ncall);
277+
tmp[i] = stat.counts[i] ? (stat.values[i] / static_cast<float>(stat.counts[i])) * static_cast<float>(stat.ncall) : 0.0f;
279278
}
280279
out.write((const char*)tmp.data(), nval*sizeof(float));
281280
}

0 commit comments

Comments
 (0)