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

Method BoltEncoder

cpp/src/quantize/bolt.cpp:32–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32BoltEncoder::BoltEncoder(int nbytes, float scaleby):
33 _nbytes(nbytes),
34 _scaleby(scaleby),
35 _offsets(2 * nbytes),
36 _lut(16, 2 * nbytes)
37{
38 bool valid = (nbytes == 2 || nbytes == 8 || nbytes == 16 ||
39 nbytes == 24 || nbytes == 32);
40 if (!valid) {
41 printf("ERROR: Received invalid nbytes %d; "
42 "must be one of {2, 8, 16, 24, 32}.", nbytes);
43 exit(1);
44 }
45 _offsets.setZero();
46 _lut.setZero();
47}
48
49void BoltEncoder::set_offsets(const float* v, int len) {
50 _offsets.resize(len);

Callers 2

__init__Method · 0.80
fitMethod · 0.80

Calls 1

setZeroMethod · 0.45

Tested by

no test coverage detected