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

Function ensure_hot

nodedb-codec/src/vector_quant/ternary/codec.rs:55–61  ·  view source on GitHub ↗

Expand cold-packed bits to hot if needed.

(packed: &[u8], quant_mode: u16, dim: usize)

Source from the content-addressed store, hash-verified

53
54/// Expand cold-packed bits to hot if needed.
55fn ensure_hot(packed: &[u8], quant_mode: u16, dim: usize) -> std::borrow::Cow<'_, [u8]> {
56 if quant_mode == QuantMode::TernaryPacked as u16 {
57 std::borrow::Cow::Owned(cold_to_hot(packed, dim))
58 } else {
59 std::borrow::Cow::Borrowed(packed)
60 }
61}
62
63impl VectorCodec for TernaryCodec {
64 type Quantized = TernaryQuantized;

Callers 2

Calls 1

cold_to_hotFunction · 0.85

Tested by

no test coverage detected