save partial imatrix
This commit is contained in:
parent
963552903f
commit
0e36739915
1 changed files with 2 additions and 3 deletions
|
@ -250,8 +250,7 @@ void IMatrixCollector::save_imatrix(int ncall) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_zeros > 0) {
|
if (n_zeros > 0) {
|
||||||
fprintf(stderr, "%s: entry '%40s' has partial data (%.2f%%) - skipping\n", __func__, kv.first.c_str(), 100.0f * (n_all - n_zeros) / n_all);
|
fprintf(stderr, "%s: entry '%40s' has partial data (%.2f%%)\n", __func__, kv.first.c_str(), 100.0f * (n_all - n_zeros) / n_all);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n_entries++;
|
n_entries++;
|
||||||
|
@ -275,7 +274,7 @@ void IMatrixCollector::save_imatrix(int ncall) const {
|
||||||
if (nval > 0) {
|
if (nval > 0) {
|
||||||
std::vector<float> tmp(nval);
|
std::vector<float> tmp(nval);
|
||||||
for (int i = 0; i < nval; i++) {
|
for (int i = 0; i < nval; i++) {
|
||||||
tmp[i] = (stat.values[i] / static_cast<float>(stat.counts[i])) * static_cast<float>(stat.ncall);
|
tmp[i] = stat.counts[i] ? (stat.values[i] / static_cast<float>(stat.counts[i])) * static_cast<float>(stat.ncall) : 0.0f;
|
||||||
}
|
}
|
||||||
out.write((const char*)tmp.data(), nval*sizeof(float));
|
out.write((const char*)tmp.data(), nval*sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue