sci-run / tasks /surface-code-decoding /surface-code-decoding-astra-xhigh-1h100-48h-20261020b /submissions /S040 /r3_pattern_runtime.py
Download tasks/surface-code-decoding/surface-code-decoding-astra-xhigh-1h100-48h-20261020b/submissions/S040/r3_pattern_runtime.py from s42chen/sci-run: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/datasets/s42chen/sci-run/resolve/main/tasks/surface-code-decoding/surface-code-decoding-astra-xhigh-1h100-48h-20261020b/submissions/S040/r3_pattern_runtime.py
- Command line
-
hf download hf://datasets/s42chen/sci-run/tasks/surface-code-decoding/surface-code-decoding-astra-xhigh-1h100-48h-20261020b/submissions/S040/r3_pattern_runtime.py
-
curl -L -o r3_pattern_runtime.py https://huggingface.co/datasets/s42chen/sci-run/resolve/main/tasks/surface-code-decoding/surface-code-decoding-astra-xhigh-1h100-48h-20261020b/submissions/S040/r3_pattern_runtime.py
481 Bytes
| """Optional three-round detector-pattern refinement of a retained decoder.""" | |
| import numpy as np | |
| from r3_pattern_model import predict | |
| def refine(package, record, packed, probabilities): | |
| settings = record.get('r3_pattern') | |
| if settings is None: | |
| return probabilities | |
| with np.load(package/settings['weights'], allow_pickle=False) as saved: | |
| state = {k: saved[k] for k in saved.files} | |
| return predict(packed, state, probabilities, mode=settings['mode']) | |