Skip to content

Commit ee2509f

Browse files
committed
Adjust threshold
1 parent 9b841eb commit ee2509f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/imatrix/imatrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int compute_tensor_statistics(std::vector<tensor_statistics> & tstats, co
169169
const float sqr_sum = std::inner_product(activations.begin(), activations.end(), activations.begin(), 0.0f);
170170
const float variance = (sqr_sum / activations.size()) - (mean * mean);
171171
const float std_deviation = std::sqrt(std::max(0.0f, variance));
172-
const float threshold = 1e-5f;
172+
const float threshold = 1e-5f * std_deviation;
173173
const int inactive_count = std::count_if(activations.begin(), activations.end(), [threshold](const float v) { return fabsf(v) <= threshold; });
174174
const float active_ratio = 1 - static_cast<float>(inactive_count) / activations.size();
175175

@@ -1199,7 +1199,7 @@ static bool show_statistics(const common_params & params) {
11991199
return false;
12001200
}
12011201
if (!ts.empty()) {
1202-
compute_cossim(ts);
1202+
compute_layer_statistics(ts);
12031203
} else {
12041204
LOG_ERR("Error: cannot compute statistics for %s\n\n", params.in_files[0].c_str());
12051205
return false;

0 commit comments

Comments
 (0)