AndrewThompson1233/maba-v2-architecture main
pytest test frameworkPython repeats repository clone calls
SHA-25679fc78a6fa39c44e21b779192253b3a4923e71d5991cb94f353044e12c20d349
MaleculeH₂(DbPo)Md(Pa)
Evidence
1
2import gc
3import pytest
4import torch
5
⋯5 lines
21:32… ,
22)
23
24CUDA_AVAILABLE = torch.cuda.is_available() and is_cuda_sm75_available()
25TRITON_ACTIVE = CUDA_AVAILABLE and is_triton_available()
26
27
28@pytest.fixture(autouse=True)
29def reset_dispatcher(monkeypatch):
30 monkeypatch.delenv("MABA_BACKEND", raising=False)
31 monkeypatch.delenv(" …
⋯4 lines
39class TestCentroidAutogradGradientStress:
40
41 @pytest.mark.skipif(not CUDA_AVAILABLE, reason="Requires CUDA sm_75+")
42 @pytest.mark.parametrize("B,L,d_idx", [
43 (1, 64, 64),
44 (2, 128, 64),
⋯4 lines
61:17… entroids.sum()
62 loss.backward()
63
64 assert k.grad is not None
65 assert not torch.isnan(k.grad).any()
66 assert not torch.isinf(k.grad).any()
67
68 min_bound = 1.0 / (2.0 * block_size) - 1e-6
69 assert (k.grad >= min_bound).all(), (
70 f"Positivity bound violated: min {k.grad.min().item()} < {min_bound} at shape ({B}, {L}, {d_idx})"
71 )
72
73 @pytest.mark.skipif(not CUDA_AVAILA …
154:50… cuda", dtype=torch.float32, requires_grad=True)
155 k_tri = k_ref.detach().clone().requires_grad_(True)
156
157 c_ref = ref_compute_centroids(k_ref, block_size=block_size)
158 c_tri = triton_compute_ce …