MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / bits_per_weight

Method bits_per_weight

nodedb-codec/src/vector_quant/layout.rs:47–60  ·  view source on GitHub ↗

Bits per weight for each mode — used by [`target_size`] to compute the packed-bits byte count.

(self)

Source from the content-addressed store, hash-verified

45 /// Bits per weight for each mode — used by [`target_size`] to compute the
46 /// packed-bits byte count.
47 fn bits_per_weight(self) -> u32 {
48 match self {
49 QuantMode::Binary => 1,
50 QuantMode::RaBitQ => 1,
51 QuantMode::TernaryPacked => 2, // 5 trits/byte ≈ 1.6 bpw; ceil to 2 for alignment
52 QuantMode::TernarySimd => 2,
53 QuantMode::Bbq => 1,
54 QuantMode::TurboQuant4b => 4,
55 QuantMode::Sq8 => 8,
56 QuantMode::Pq => 8,
57 QuantMode::Itq3S => 2,
58 QuantMode::PolarQuant => 4,
59 }
60 }
61}
62
63// ── QuantHeader ────────────────────────────────────────────────────────────

Callers 1

packed_bits_lenFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected