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

Function compare_ggml_vs_nhwc

tests/test_debug_encoder.cpp:24–28  ·  view source on GitHub ↗

Compare C++ ggml tensor (dumped as [ne0, ne1, ne2]) vs Python NHWC [1, H, W, E] ggml stores: flat[e + w*E + h*E*W] where ne0=E, ne1=W, ne2=H Python NHWC: flat[h*W*E + w*E + e] (with optional batch dim) These are actually the same flat layout!

Source from the content-addressed store, hash-verified

22// Python NHWC: flat[h*W*E + w*E + e] (with optional batch dim)
23// These are actually the same flat layout!
24static compare_result compare_ggml_vs_nhwc(const ref_tensor_f32& cpp,
25 const ref_tensor_f32& ref) {
26 return compare_tensors(cpp.data.data(), ref.data.data(),
27 std::min(cpp.numel(), ref.numel()));
28}
29
30// Compare C++ ggml tensor (dumped as [C, W, H]) vs Python NCHW [1, C, H, W]
31// ggml stores: flat[c + w*C + h*C*W]

Callers 1

mainFunction · 0.70

Calls 2

compare_tensorsFunction · 0.70
numelMethod · 0.45

Tested by

no test coverage detected