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

Function run_encoder_part

tests/python/test_docexamples_f32.py:127–138  ·  view source on GitHub ↗
(side_information)

Source from the content-addressed store, hash-verified

125 stds = np.array([6.4, 4.2, 3.9], dtype=np.float32)
126
127 def run_encoder_part(side_information):
128 # Construct a `ChainCoder` for *decoding*:
129 coder = constriction.stream.chain.ChainCoder(
130 side_information, # Provided bit string.
131 is_remainders=False, # Bit string is *not* remaining data after decoding.
132 seal=True # Bit string comes from an external source here.
133 )
134 # Decode side information into a sequence of symbols as usual in bits-back coding:
135 symbols = coder.decode(leaky_gaussian, means, stds)
136 # Obtain what's *remaining* on the coder after decoding the symbols:
137 remaining1, remaining2 = coder.get_remainders()
138 return symbols, np.concatenate([remaining1, remaining2])
139
140 def run_decoder_part(symbols, remaining):
141 # Construct a `ChainCoder` for *encoding*:

Callers 1

test_chain1Function · 0.70

Calls 2

decodeMethod · 0.95
get_remaindersMethod · 0.95

Tested by

no test coverage detected