File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2140,6 +2140,27 @@ struct test_set_rows : public test_case {
2140
2140
}
2141
2141
}
2142
2142
}
2143
+
2144
+ double max_nmse_err () override {
2145
+ if (type == GGML_TYPE_Q4_0 || type == GGML_TYPE_Q4_1 || type == GGML_TYPE_IQ4_NL ||
2146
+ type == GGML_TYPE_Q5_0 || type == GGML_TYPE_Q5_1 || type == GGML_TYPE_Q8_0) {
2147
+ // estimate what the max nmse error would be if one quantized value is
2148
+ // off by one. The test values are distributed in [-1,1], so it'll be
2149
+ // roughly (2.0 / 2^bits)^2, divided by the mean square value of the reference,
2150
+ // which is roughly 0.25 times the number of elements.
2151
+ double err_estimate = 1 .0f /8 .0f ;
2152
+ if (type == GGML_TYPE_Q5_0 || type == GGML_TYPE_Q5_1) {
2153
+ err_estimate /= 2 .0f ;
2154
+ }
2155
+ if (type == GGML_TYPE_Q8_0) {
2156
+ err_estimate /= 8 .0f ;
2157
+ }
2158
+ err_estimate *= err_estimate;
2159
+ err_estimate /= 0 .25f *float (ne[0 ] * r * ne[2 ]*nr23[0 ] * ne[3 ]*nr23[1 ]);
2160
+ return err_estimate;
2161
+ }
2162
+ return 1e-7 ;
2163
+ }
2143
2164
};
2144
2165
2145
2166
// GGML_OP_ARGMAX
You can’t perform that action at this time.
0 commit comments