Skip to content

postselection_mask unsupported in sinter v1.14.0 #887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kaavyas99 opened this issue Feb 19, 2025 · 2 comments
Open

postselection_mask unsupported in sinter v1.14.0 #887

kaavyas99 opened this issue Feb 19, 2025 · 2 comments

Comments

@kaavyas99
Copy link

A sinter.Task with a specified postselection_mask parameter compiles and runs successfully when input into sinter.collect with stim==1.13.0 and sinter==1.13.0. However, when both are updated to 1.14.0, the following appears:

ValueError: predictions.shape[0] != num_shots

A relevant code snippet to help demonstrate this:

s_tasks = [
    sinter.Task(circuit=this_circ, postselection_mask=bit_packed_array_for_this_circ_dets)
]

collected_stats: List[sinter.TaskStats] = sinter.collect(
    num_workers=4,
    tasks=s_tasks,
    decoders=['pymatching'],
    max_shots=100_000,
    max_errors=100,
    print_progress=True,
)

This issue may be due to changes made in #804 .

@Strilanc
Copy link
Collaborator

Do you have a circuit that triggers this? When I attempt to reproduce it, it works fine:

from typing import List

import numpy as np
import sinter
import stim

if __name__ == '__main__':
    this_circ = stim.Circuit.generated(code_task='surface_code:rotated_memory_x', distance=5, rounds=3)
    bit_packed_array_for_this_circ_dets = np.zeros(shape=(this_circ.num_detectors + 7) // 8, dtype=np.uint8)
    s_tasks = [
        sinter.Task(circuit=this_circ, postselection_mask=bit_packed_array_for_this_circ_dets)
    ]
    
    collected_stats: List[sinter.TaskStats] = sinter.collect(
        num_workers=4,
        tasks=s_tasks,
        decoders=['pymatching'],
        max_shots=1000,
        max_errors=10,
        print_progress=True,
    )

@Strilanc
Copy link
Collaborator

Nevermind, got it. Needs to actually postselect some shots.

from typing import List

import numpy as np
import sinter
import stim

if __name__ == '__main__':
    this_circ = stim.Circuit.generated(code_task='surface_code:rotated_memory_x', distance=5, rounds=3, after_clifford_depolarization=0.1)
    bit_packed_array_for_this_circ_dets = np.ones(shape=(this_circ.num_detectors + 7) // 8, dtype=np.uint8)
    s_tasks = [
        sinter.Task(circuit=this_circ, postselection_mask=bit_packed_array_for_this_circ_dets)
    ]
    
    collected_stats: List[sinter.TaskStats] = sinter.collect(
        num_workers=4,
        tasks=s_tasks,
        decoders=['pymatching'],
        max_shots=100000,
        max_errors=1000,
        print_progress=True,
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants