MCPcopy Create free account
hub / github.com/dblalock/bolt / check_encoding

Function check_encoding

cpp/test/quantize/test_bolt.cpp:220–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void check_encoding(int nrows, const ColMatrix<uint8_t>& encoding_out) {
221
222 // number of rows in output must be a multiple of 32, and >32 would
223 // require us to rewrite this to look at indices within each block
224 // instead of letting column-major indexing handle everything for us
225 size_t nrows_out = encoding_out.rows();
226 REQUIRE(nrows_out == 32);
227
228 for (int i = 0; i < nrows; i++) {
229 for(int m = 0; m < 2 * M; m++) {
230 // indices are packed into upper and lower 4 bits
231 int byte = encoding_out(i, m / 2);
232 int idx = m % 2 ? byte >> 4 : byte & 0x0F;
233 REQUIRE(idx == m + (i % 5)); // i % 5 from how we designed mat
234 }
235 }
236}
237
238TEST_CASE("bolt_encode", "[mcq][bolt]") {
239 auto centroids = create_bolt_centroids(1);

Callers 1

test_bolt.cppFile · 0.70

Calls 1

rowsMethod · 0.45

Tested by

no test coverage detected