Compare raw flat data (same byte layout between Python and C++)
| 80 | |
| 81 | // Compare raw flat data (same byte layout between Python and C++) |
| 82 | static metric_row compare_flat(const char * stage, const char * label, |
| 83 | const std::string & cpp_path, |
| 84 | const std::string & ref_path, |
| 85 | float atol) { |
| 86 | auto cpp = load_ref_f32(cpp_path); |
| 87 | auto ref = load_ref_f32(ref_path); |
| 88 | metric_row m; |
| 89 | m.stage = stage; |
| 90 | m.name = label; |
| 91 | m.tolerance = atol; |
| 92 | if (cpp.data.empty() || ref.data.empty()) { |
| 93 | fprintf(stderr, " [SKIP] %s (cpp=%s ref=%s)\n", label, |
| 94 | cpp.data.empty() ? "missing" : "ok", |
| 95 | ref.data.empty() ? "missing" : "ok"); |
| 96 | return m; |
| 97 | } |
| 98 | std::string s; |
| 99 | for (size_t i = 0; i < ref.shape.size(); ++i) { |
| 100 | if (i > 0) s += ","; |
| 101 | s += std::to_string(ref.shape[i]); |
| 102 | } |
| 103 | m.shape_str = s; |
| 104 | int n = std::min(cpp.numel(), ref.numel()); |
| 105 | return compute_full_metrics(cpp.data.data(), ref.data.data(), n, atol); |
| 106 | } |
| 107 | |
| 108 | int main(int argc, char ** argv) { |
| 109 | if (argc < 3) { |
no test coverage detected