Total quantization error on test data
| 60 | |
| 61 | // Total quantization error on test data |
| 62 | static float reference_quantization_error(const ggml_type_traits * qfns, const ggml_type_traits_cpu * qfns_cpu, size_t test_size, const float * test_data) { |
| 63 | std::vector<uint8_t> tmp_q(2*test_size); |
| 64 | std::vector<float> tmp_out(test_size); |
| 65 | std::vector<float> tmp_out_ref(test_size); |
| 66 | |
| 67 | // FIXME: why is done twice? |
| 68 | qfns_cpu->from_float(test_data, tmp_q.data(), test_size); |
| 69 | qfns->to_float(tmp_q.data(), tmp_out.data(), test_size); |
| 70 | |
| 71 | qfns->from_float_ref(test_data, tmp_q.data(), test_size); |
| 72 | qfns->to_float(tmp_q.data(), tmp_out_ref.data(), test_size); |
| 73 | |
| 74 | return array_rmse(tmp_out.data(), tmp_out_ref.data(), test_size); |
| 75 | } |
| 76 | |
| 77 | static float dot_product(const float * a1, const float * a2, size_t test_size) { |
| 78 | double sum = 0; |
no test coverage detected