-
Notifications
You must be signed in to change notification settings - Fork 714
[Capture] default.qubit defer_measurements finite shots execution
#6961
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
Conversation
|
@albi3ro @astralcai I've tentatively opened the PR for review. The testing questions I mentioned in stand-up remain unresolved, and I would love if you're able to provide feedback on that. Thanks! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6961 +/- ##
==========================================
- Coverage 99.60% 99.60% -0.01%
==========================================
Files 488 488
Lines 46638 46659 +21
==========================================
+ Hits 46455 46474 +19
- Misses 183 185 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Context:
This PR is a follow up on #6838 and #6937 to add finite shot execution support to
default.qubit.Description of the Change:
DefaultQubitInterpreterto handle the ability to update shots based on the specifiedpostselect_mode. The currently supportedpostselect_modes are"hw-like"and"fill-shots".DeferMeasurementsInterpreterto not useaux_wires. This is needed so that we don't need to know ahead of time which wires to use to map MCMs. Instead, now we specifynum_wires, which should be an integer for the total number of available wires. When executing, this should be known since the device requires wires to be specified.>>> jax.make_jaxpr(f)(0) { lambda ; a:i64[]. let _:AbstractOperator() = CNOT[n_wires=2] a 0 in () }n=0, we will expectedly fail because we tried to create aCNOT([0, 0]). This is expected, but would be nice if it could be caught at capture time rather than runtime. I have updated thedefer_measurementsdocumentation accordingly. Let me know if there are any other suggestions about how to deal with this.DefaultQubitInterpreterto acceptExecutionConfig.Benefits:
Possible Drawbacks:
Using
hw-likepostselection currently will not be jit friendly when returningqml.sample, as the number of samples can be less than the original number of samples non-deterministically.Future Work:
mcm_methodandpostselect_modearguments ofQNode.Related GitHub Issues:
[sc-82064]