Total quantization error on test data
| 51 | |
| 52 | // Total quantization error on test data |
| 53 | static float reference_quantization_error(ggml_type_traits_t & qfns, size_t test_size, const float * test_data) { |
| 54 | std::vector<uint8_t> tmp_q(2*test_size); |
| 55 | std::vector<float> tmp_out(test_size); |
| 56 | std::vector<float> tmp_out_ref(test_size); |
| 57 | |
| 58 | qfns.from_float(test_data, tmp_q.data(), test_size); |
| 59 | qfns.to_float(tmp_q.data(), tmp_out.data(), test_size); |
| 60 | |
| 61 | qfns.from_float_reference(test_data, tmp_q.data(), test_size); |
| 62 | qfns.to_float(tmp_q.data(), tmp_out_ref.data(), test_size); |
| 63 | |
| 64 | return array_rmse(tmp_out.data(), tmp_out_ref.data(), test_size); |
| 65 | } |
| 66 | |
| 67 | static float dot_product(const float * a1, const float * a2, size_t test_size) { |
| 68 | double sum = 0; |
no test coverage detected