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

Function test_ans_encode_reverse1

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

Source from the content-addressed store, hash-verified

343
344
345def test_ans_encode_reverse1():
346 # Define a concrete categorical entropy model over the (implied)
347 # alphabet {0, 1, 2}:
348 probabilities = np.array([0.1, 0.6, 0.3], dtype=np.float64)
349 model = constriction.stream.model.Categorical(probabilities, perfect=False)
350
351 # Encode a single symbol with this entropy model:
352 coder = constriction.stream.stack.AnsCoder()
353 coder.encode_reverse(2, model) # Encodes the symbol `2`.
354
355
356def test_ans_encode_reverse2():

Callers

nothing calls this directly

Calls 1

encode_reverseMethod · 0.95

Tested by

no test coverage detected