Remove nested directory: BitTransformerLM/tests/test_bit_io.py
Browse files
BitTransformerLM/tests/test_bit_io.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
import sys
|
| 2 |
-
import pathlib
|
| 3 |
-
import torch
|
| 4 |
-
|
| 5 |
-
sys.path.append(str(pathlib.Path(__file__).resolve().parents[1]))
|
| 6 |
-
from bit_transformer.parity import enforce_parity
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
def test_enforce_parity_corrects_bits():
|
| 10 |
-
bits = torch.tensor([[1, 0, 0, 0, 0, 0, 0, 0, 0]])
|
| 11 |
-
corrected, count = enforce_parity(bits)
|
| 12 |
-
assert count == 1
|
| 13 |
-
payload = corrected.view(-1, 9)[0, :8]
|
| 14 |
-
parity = corrected.view(-1, 9)[0, 8]
|
| 15 |
-
assert parity.item() == int(payload.sum() % 2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|