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

Function check

tests/test_vit.cpp:73–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73static bool check(const std::string & name, const float * got, const ref_tensor & ref,
74 float atol = 1e-4f, float rtol = 1e-3f) {
75 if (ref.data.empty()) {
76 fprintf(stderr, " [SKIP] %s — no reference data\n", name.c_str());
77 return true;
78 }
79 float max_diff = compare_tensors(got, ref.data.data(), ref.numel(), atol, rtol);
80 bool ok = max_diff < atol + rtol;
81 fprintf(stderr, " %s %s: max_diff=%.6f (atol=%.1e rtol=%.1e)\n",
82 ok ? "[PASS]" : "[FAIL]", name.c_str(), max_diff, atol, rtol);
83 return ok;
84}
85
86// ═══════════════════════════════════════════════════════════════════════════════
87// Test: preprocessing

Callers

nothing calls this directly

Calls 2

compare_tensorsFunction · 0.70
numelMethod · 0.45

Tested by

no test coverage detected