MCPcopy Create free account
hub / github.com/DevTechJr/turboquant_cutile / __init__

Method __init__

turboquant_cutile/codebook.py:64–68  ·  view source on GitHub ↗
(self, d: int, bits: int)

Source from the content-addressed store, hash-verified

62 """Pre-solved Lloyd-Max codebook for a given (d, bits) pair."""
63
64 def __init__(self, d: int, bits: int):
65 self.d = d
66 self.bits = bits
67 self.n_levels = 1 << bits
68 self.centroids, self.boundaries = solve_lloyd_max(d, bits)
69
70 def quantize(self, x: torch.Tensor) -> torch.Tensor:
71 diffs = x.unsqueeze(-1) - self.centroids.to(x.device)

Callers

nothing calls this directly

Calls 1

solve_lloyd_maxFunction · 0.85

Tested by

no test coverage detected