Update aggregated sum of squared activations per layer
This commit is contained in:
parent
b37393423d
commit
906548a00a
|
|
@ -1294,7 +1294,6 @@ static bool show_statistics(const common_params & params) {
|
||||||
struct weighted_stats {
|
struct weighted_stats {
|
||||||
float w_sum = 0.0f;
|
float w_sum = 0.0f;
|
||||||
float w_zd = 0.0f;
|
float w_zd = 0.0f;
|
||||||
float w_cossim = 0.0f;
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
};
|
};
|
||||||
std::map<int, weighted_stats> ws;
|
std::map<int, weighted_stats> ws;
|
||||||
|
|
@ -1341,16 +1340,15 @@ static bool show_statistics(const common_params & params) {
|
||||||
100.0f * tstat.zd_score,
|
100.0f * tstat.zd_score,
|
||||||
tstat.cossim);
|
tstat.cossim);
|
||||||
|
|
||||||
const float w_sum = tstat.elements * tstat.sum_values;
|
|
||||||
const float w_zd = tstat.elements * tstat.zd_score;
|
const float w_zd = tstat.elements * tstat.zd_score;
|
||||||
|
|
||||||
if (ws.find(blk) != ws.end()) {
|
if (ws.find(blk) != ws.end()) {
|
||||||
ws[blk].w_sum += w_sum;
|
ws[blk].w_sum += tstat.sum_values;
|
||||||
ws[blk].w_zd += w_zd;
|
ws[blk].w_zd += w_zd;
|
||||||
ws[blk].n += tstat.elements;
|
ws[blk].n += tstat.elements;
|
||||||
} else {
|
} else {
|
||||||
weighted_stats temp_ws;
|
weighted_stats temp_ws;
|
||||||
temp_ws.w_sum = w_sum;
|
temp_ws.w_sum = tstat.sum_values;
|
||||||
temp_ws.w_zd = w_zd;
|
temp_ws.w_zd = w_zd;
|
||||||
temp_ws.n = tstat.elements;
|
temp_ws.n = tstat.elements;
|
||||||
ws[blk] = temp_ws;
|
ws[blk] = temp_ws;
|
||||||
|
|
@ -1371,7 +1369,7 @@ static bool show_statistics(const common_params & params) {
|
||||||
LOG_INF("============================================\n");
|
LOG_INF("============================================\n");
|
||||||
for (const auto & [layer, stats] : ws) {
|
for (const auto & [layer, stats] : ws) {
|
||||||
if (layer < 0 || stats.n == 0) continue;
|
if (layer < 0 || stats.n == 0) continue;
|
||||||
const float w_sum = stats.w_sum / stats.n;
|
const float w_sum = stats.w_sum;
|
||||||
const float w_zd = stats.w_zd / stats.n;
|
const float w_zd = stats.w_zd / stats.n;
|
||||||
const auto lcs = layer_cossim.find(layer);
|
const auto lcs = layer_cossim.find(layer);
|
||||||
const float cossim = (lcs != layer_cossim.end()) ? lcs->second : 0.0f;
|
const float cossim = (lcs != layer_cossim.end()) ? lcs->second : 0.0f;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue