MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / reference_quantization_error

Function reference_quantization_error

external/ggml/tests/test-quantize-fns.cpp:62–75  ·  view source on GitHub ↗

Total quantization error on test data

Source from the content-addressed store, hash-verified

60
61// Total quantization error on test data
62static 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
77static float dot_product(const float * a1, const float * a2, size_t test_size) {
78 double sum = 0;

Callers 1

mainFunction · 0.85

Calls 2

array_rmseFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected