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

Function dot_product_error

tests/test-quantize-fns.cpp:76–93  ·  view source on GitHub ↗

Total dot product error

Source from the content-addressed store, hash-verified

74
75// Total dot product error
76static float dot_product_error(
77 ggml_type_traits_t & qfns, size_t test_size, const float * test_data1, const float *test_data2
78) {
79 std::vector<uint8_t> tmp_q1(2*test_size);
80 std::vector<uint8_t> tmp_q2(2*test_size);
81
82 auto vdot = ggml_internal_get_type_traits(qfns.vec_dot_type);
83
84 qfns.from_float(test_data1, tmp_q1.data(), test_size);
85 vdot.from_float(test_data2, tmp_q2.data(), test_size);
86
87 float result = INFINITY;
88 qfns.vec_dot(test_size, &result, tmp_q1.data(), tmp_q2.data());
89
90 const float dot_ref = dot_product(test_data1, test_data2, test_size);
91
92 return fabsf(result - dot_ref) / test_size;
93}
94
95int main(int argc, char * argv[]) {
96 bool verbose = false;

Callers 1

mainFunction · 0.70

Calls 3

dot_productFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected