MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / print_error_stats

Function print_error_stats

examples/quantize-stats/quantize-stats.cpp:117–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117static void print_error_stats(const std::string & name, const error_stats & stats, bool print_histogram) {
118 double rmse = sqrt(stats.total_error / (double) stats.num_samples);
119 double median = find_quantile(stats, .5);
120 double pct95 = find_quantile(stats, .95);
121 printf("%-50s: rmse %.8f, maxerr %.8f, 95pct<%.4f, median<%.4f\n", name.c_str(), rmse, stats.max_error, pct95, median);
122 if (print_histogram) {
123 printf("Error distribution:\n");
124 for (size_t i = 0; i < HISTOGRAM_BUCKETS; i++) {
125 double lower = i * HISTOGRAM_RANGE / HISTOGRAM_BUCKETS;
126 double upper = (i+1) * HISTOGRAM_RANGE / HISTOGRAM_BUCKETS;
127 if (i == HISTOGRAM_BUCKETS -1) upper = INFINITY;
128 printf("[%3.4f, %3.4f): %11" PRIu64 "\n", lower, upper, stats.error_histogram[i]);
129 }
130 }
131}
132
133// copied from ggml.h - verify that we can access this as a flat array
134static bool tensor_is_contiguous(const struct ggml_tensor * tensor) {

Callers 2

test_roundtrip_on_layerFunction · 0.70
mainFunction · 0.70

Calls 4

sqrtFunction · 0.85
printfFunction · 0.85
find_quantileFunction · 0.70
c_strMethod · 0.45

Tested by 1

test_roundtrip_on_layerFunction · 0.56