()
| 574 | |
| 575 | |
| 576 | def test_range_coder_encode4(): |
| 577 | # Define 2 categorical models over the alphabet {0, 1, 2, 3, 4}: |
| 578 | probabilities = np.array( |
| 579 | [[0.1, 0.2, 0.3, 0.1, 0.3], # (for first encoded symbol) |
| 580 | [0.3, 0.2, 0.2, 0.2, 0.1]], # (for second encoded symbol) |
| 581 | dtype=np.float64) |
| 582 | model_family = constriction.stream.model.Categorical(perfect=False) |
| 583 | |
| 584 | # Encode 2 symbols (needs `len(symbols) == probabilities.shape[0]`): |
| 585 | symbols = np.array([3, 1], dtype=np.int32) |
| 586 | encoder = constriction.stream.queue.RangeEncoder() |
| 587 | encoder.encode(symbols, model_family, probabilities) |
| 588 | assert np.all(encoder.get_compressed() == |
| 589 | np.array([2705829254], dtype=np.uint32)) |
| 590 | |
| 591 | |
| 592 | def test_range_coding_decode1(): |
nothing calls this directly
no test coverage detected