MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / check

Function check

tests/test_phase3.cpp:99–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static bool check(const std::string & name, const float * got, const ref_tensor & ref,
100 float atol, int & n_pass, int & n_fail) {
101 if (ref.data.empty()) {
102 fprintf(stderr, " [SKIP] %s — no reference data\n", name.c_str());
103 return true;
104 }
105 auto r = compare_tensors(got, ref.data.data(), ref.numel(), atol);
106 bool ok = r.max_diff <= atol;
107 fprintf(stderr, " %s %-45s: max=%.6e mean=%.6e cos=%.8f bad=%d/%d (atol=%.1e)\n",
108 ok ? "[PASS]" : "[FAIL]", name.c_str(), r.max_diff, r.mean_diff,
109 r.cosine_sim, r.n_bad, r.n_elements, atol);
110 if (ok) n_pass++; else n_fail++;
111 return ok;
112}
113
114// ═══════════════════════════════════════════════════════════════════════════════
115// Test 1: RoPE computation

Callers 3

test_ropeFunction · 0.70
test_sinusoidal_peFunction · 0.70
test_encode_imageFunction · 0.70

Calls 2

compare_tensorsFunction · 0.70
numelMethod · 0.45

Tested by

no test coverage detected