-
Notifications
You must be signed in to change notification settings - Fork 585
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
remove _qfunc_output from tape #4651
Conversation
Hello. You may have forgotten to update the changelog!
|
[sc-36827] |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4651 +/- ##
==========================================
- Coverage 99.63% 99.63% -0.01%
==========================================
Files 376 376
Lines 33666 33647 -19
==========================================
- Hits 33542 33523 -19
Misses 124 124
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
My only comment is about a changelog. Maybe just an "Improvement"? Something like _qfunc_output is pruned from QuantumScript
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me once @albi3ro 's comment is addressed! 🚀
#6153) **Context:** In #4651, `tape._qfunc_output` was removed. As a consequence, for `qml.pattern_matching_optimization`, the original quantum function output (used to re-create the quantum function output of the new tape) was removed. Since in the optimization process of `qml.pattern_matching_optimization` the measurements of the original tape are not involved, the measurements of the tape coming out from the optimization process correspond to an empty list, causing information on such a variable to be lost in the optimization process. **Description of the Change:** We simply store the original measurements and assign them to the new (optimized) tape, similarly to the original approach (see #2032). **Benefits:** Measurements are preserved in the optimization process. **Possible Drawbacks:** I can think of none since measurements should not be involved in the optimization process. **Related GitHub Issues:** #6088 **Related Shortcut Stories** [sc-71174] --------- Co-authored-by: Christina Lee <christina@xanadu.ai>
Context:
_qfunc_output
is a pain to keep track of, and we only need it for QNode handling.QNode._qfunc_output
still exists, buttape._qfunc_output
does not.Description of the Change:
tape._qfunc_output
make_qscript
so it can get the tape result shapeparam_shift_cv
(the only other place that usedtape._qfunc_output
) because it doesn't accept parameter broadcasting, shot vectors, or multiple measurements, so it really never needs ittype(tape)
so QuantumScript in = QuantumScript outBenefits:
everyone hates
tape._qfunc_output
so this should bring peace of mind. less work, one less private attribute being used publicly.Possible Drawbacks:
Maybe harder to see the output shape of a tape?
tape.measurements
should mostly make it clear.