Refactor variable names
This commit is contained in:
parent
c7959edff5
commit
3e9d53c61e
|
|
@ -47,16 +47,16 @@ struct Stats {
|
||||||
struct tensor_statistics {
|
struct tensor_statistics {
|
||||||
std::string tensor;
|
std::string tensor;
|
||||||
Stats stats;
|
Stats stats;
|
||||||
float sum_values = 0.0f;
|
float sum_values = 0.0f;
|
||||||
float mean_values = 0.0f;
|
float mean_values = 0.0f;
|
||||||
float max_values = 0.0f;
|
float max_values = 0.0f;
|
||||||
float min_values = 0.0f;
|
float min_values = 0.0f;
|
||||||
int elements = 0;
|
int elements = 0;
|
||||||
float stddev = 0.0f;
|
float std_deviation = 0.0f;
|
||||||
float entropy = 0.0f;
|
float entropy = 0.0f;
|
||||||
float zd_score = 0.0f;
|
float zd_score = 0.0f;
|
||||||
float cossim = 0.0f;
|
float cossim = 0.0f;
|
||||||
float l2_norm = 0.0f;
|
float l2_norm = 0.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IMatrixCollector {
|
class IMatrixCollector {
|
||||||
|
|
@ -227,10 +227,10 @@ static bool compute_vector_statistics(std::vector<tensor_statistics> & tstats, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int z_score = 0;
|
int zd_score = 0;
|
||||||
if (std_deviation > 0.0f) {
|
if (std_deviation > 0.0f) {
|
||||||
for (const auto act : activations) {
|
for (const auto act : activations) {
|
||||||
if (const float z = (act - mean) / std_deviation; std::fabs(z) > 1.0f) z_score++;
|
if (const float z = (act - mean) / std_deviation; std::fabs(z) > 1.0f) zd_score++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,9 +242,9 @@ static bool compute_vector_statistics(std::vector<tensor_statistics> & tstats, c
|
||||||
ts.max_values = max;
|
ts.max_values = max;
|
||||||
ts.min_values = min;
|
ts.min_values = min;
|
||||||
ts.elements = static_cast<int>(activations.size());
|
ts.elements = static_cast<int>(activations.size());
|
||||||
ts.stddev = std_deviation;
|
ts.std_deviation = std_deviation;
|
||||||
ts.entropy = entropy;
|
ts.entropy = entropy;
|
||||||
ts.zd_score = static_cast<float>(z_score) / ts.elements;
|
ts.zd_score = static_cast<float>(zd_score) / ts.elements;
|
||||||
|
|
||||||
return e.activations.empty();
|
return e.activations.empty();
|
||||||
}
|
}
|
||||||
|
|
@ -1334,7 +1334,7 @@ static bool show_statistics(const common_params & params) {
|
||||||
tstat.min_values,
|
tstat.min_values,
|
||||||
tstat.max_values,
|
tstat.max_values,
|
||||||
tstat.mean_values,
|
tstat.mean_values,
|
||||||
tstat.stddev,
|
tstat.std_deviation,
|
||||||
tstat.elements,
|
tstat.elements,
|
||||||
tstat.entropy,
|
tstat.entropy,
|
||||||
100.0f * (tstat.entropy / std::log2(tstat.elements)),
|
100.0f * (tstat.entropy / std::log2(tstat.elements)),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue