()
| 367 | |
| 368 | |
| 369 | def test_ans_encode_reverse3(): |
| 370 | # Define a generic quantized Gaussian distribution for all integers |
| 371 | # in the range from -100 to 100 (both ends inclusive): |
| 372 | model_family = constriction.stream.model.QuantizedGaussian(-100, 100) |
| 373 | |
| 374 | # Specify the model parameters for each symbol: |
| 375 | means = np.array([10.3, -4.7, 20.5], dtype=np.float64) |
| 376 | stds = np.array([5.2, 24.2, 3.1], dtype=np.float64) |
| 377 | |
| 378 | # Encode an example message: |
| 379 | # (needs `len(symbols) == len(means) == len(stds)`) |
| 380 | symbols = np.array([12, -13, 25], dtype=np.int32) |
| 381 | coder = constriction.stream.stack.AnsCoder() |
| 382 | coder.encode_reverse(symbols, model_family, means, stds) |
| 383 | assert np.all(coder.get_compressed() == np.array( |
| 384 | [597775281, 3], dtype=np.uint32)) |
| 385 | |
| 386 | |
| 387 | def test_ans_encode_reverse4(): |
nothing calls this directly
no test coverage detected