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