MCPcopy Create free account
hub / github.com/kyegomez/BitNet / test_absmax_quantize_bits

Function test_absmax_quantize_bits

tests/tests.py:48–51  ·  view source on GitHub ↗
(random_tensor, bits)

Source from the content-addressed store, hash-verified

46
47@pytest.mark.parametrize("bits", [4, 8, 12, 16])
48def test_absmax_quantize_bits(random_tensor, bits):
49 quant, dequant = absmax_quantize(random_tensor, bits=bits)
50 assert quant.dtype == torch.int8
51 assert torch.allclose(dequant, random_tensor, atol=1e-2)
52
53
54# More Tests for BitLinear:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected