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

Function fixed_model_params

tests/python/test_docexamples_f32.py:677–688  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

675
676def test_custom_model_ans():
677 def fixed_model_params():
678 model_scipy = scipy.stats.cauchy(loc=10.3, scale=5.8)
679 # Wrap the scipy-model in a `CustomModel`, which will implicitly
680 # quantize it to integers in the given range from -100 to 100 (both
681 # ends inclusively).
682 model = constriction.stream.model.CustomModel(
683 model_scipy.cdf, model_scipy.ppf, -100, 100)
684
685 symbols = np.array([5, 14, -1, 21], dtype=np.int32)
686 coder = constriction.stream.stack.AnsCoder()
687 coder.encode_reverse(symbols, model)
688 assert np.all(coder.decode(model, 4) == symbols)
689
690 def variable_model_params():
691 # The optional argument `params` will receive a 1-d python array when

Callers 3

test_custom_model_ansFunction · 0.70
test_custom_model_rangeFunction · 0.70

Calls 8

encode_reverseMethod · 0.95
decodeMethod · 0.95
encodeMethod · 0.95
get_compressedMethod · 0.95
decodeMethod · 0.95
decodeMethod · 0.95
encode_reverseMethod · 0.95
get_dataMethod · 0.95

Tested by

no test coverage detected