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

Function test_scores_shape

tests/test_attention.py:23–31  ·  view source on GitHub ↗
(seq_q, seq_k, total_bits)

Source from the content-addressed store, hash-verified

21@pytest.mark.parametrize("seq_q,seq_k", [(1, 64), (1, 256), (1, 1024), (16, 512)])
22@pytest.mark.parametrize("total_bits", [3, 4])
23def test_scores_shape(seq_q, seq_k, total_bits):
24 engine = TurboQuantEngine(head_dim=128, total_bits=total_bits, device="cpu")
25
26 Q = torch.randn(seq_q, 128).half()
27 K = torch.randn(seq_k, 128).half()
28 compressed_k = engine.compress_keys_pytorch(K)
29 scores = engine.attention_scores_pytorch(Q, compressed_k)
30
31 assert scores.shape == (seq_q, seq_k)
32
33
34@pytest.mark.parametrize("total_bits", [3, 4])

Callers

nothing calls this directly

Calls 3

compress_keys_pytorchMethod · 0.95
TurboQuantEngineClass · 0.90

Tested by

no test coverage detected