-
Notifications
You must be signed in to change notification settings - Fork 575
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
Fix expansion of fragments tapes containing no MeasureNode
#2223
Conversation
Hello. You may have forgotten to update the changelog!
|
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.
Thanks @anthayes92! Good spot! My only question is whether the bugfix should live in the _get_measurements
helper function.
pennylane/transforms/qcut.py
Outdated
if len(group) > 0: | ||
measurements = _get_measurements(group, tape.measurements) | ||
# This ensures the measurements of the original tape are carried over to the | ||
# following tape configurations in the absence of any MeasureNodes in the fragment | ||
else: | ||
measurements = tape.measurements |
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.
We could put this logic in _get_measurements
, i.e., the first thing we do is:
if len(group) == 0:
return measurements
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.
Nice idea! I've moved it in this commit 1129df6
Codecov Report
@@ Coverage Diff @@
## master #2223 +/- ##
=======================================
Coverage 99.26% 99.26%
=======================================
Files 231 231
Lines 18241 18243 +2
=======================================
+ Hits 18107 18109 +2
Misses 134 134
Continue to review full report at Codecov.
|
Context:
Fragment tapes of cut circuit need to be expanded to multiple configurations in order to execute and recombine results. However, the observables of fragments tapes containing no
MeasureNode
were being lost.Description of the Change:
This PR fixes the logic so that measurements of such fragments persist across the following configurations
Benefits:
Fixes broken pipeline for this specific case
Related GitHub Issues:
Blocker for #2216