MCPcopy Create free account
hub / github.com/bamler-lab/constriction / test_range_coding_decode1

Function test_range_coding_decode1

tests/python/test_docexamples.py:592–602  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

590
591
592def test_range_coding_decode1():
593 # Define a concrete categorical entropy model over the (implied)
594 # alphabet {0, 1, 2}:
595 probabilities = np.array([0.1, 0.6, 0.3], dtype=np.float64)
596 model = constriction.stream.model.Categorical(probabilities, perfect=False)
597
598 # Decode a single symbol from some example compressed data:
599 compressed = np.array([3089773345, 1894195597], dtype=np.uint32)
600 decoder = constriction.stream.queue.RangeDecoder(compressed)
601 symbol = decoder.decode(model)
602 assert symbol == 2
603
604
605def test_range_coding_decode2():

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.95

Tested by

no test coverage detected