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

Function test_roundtrip_identity

tests/test_codebook.py:78–83  ·  view source on GitHub ↗

Quantize → dequantize should map each centroid exactly to itself.

()

Source from the content-addressed store, hash-verified

76
77
78def test_roundtrip_identity():
79 """Quantize → dequantize should map each centroid exactly to itself."""
80 cb = LloydMaxCodebook(128, 3)
81 indices = torch.arange(cb.n_levels)
82 reconstructed = cb.dequantize(indices)
83 assert torch.allclose(reconstructed, cb.centroids, atol=1e-6)
84
85
86def test_quantize_nearest_centroid():

Callers

nothing calls this directly

Calls 2

dequantizeMethod · 0.95
LloydMaxCodebookClass · 0.90

Tested by

no test coverage detected