Total dot product error
| 74 | |
| 75 | // Total dot product error |
| 76 | static 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 | |
| 95 | int main(int argc, char * argv[]) { |
| 96 | bool verbose = false; |
no test coverage detected