Skip to content
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

[BUGFIX] Qubit reuse for terminal measurements on wires with mid-circuit measurements #4787

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

mudit2812
Copy link
Contributor

@mudit2812 mudit2812 commented Nov 3, 2023

Context:
When making terminal measurements on wires with mid-circuit measurements, the circuit was not being transformed correctly. This PR fixes that.

Description of the Change:
Wires are considered to be reused by defer_measurements when a measured wire has operators and terminal measurements applied to it after mid-circuit measurements.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-49507]

@mudit2812 mudit2812 requested a review from a team November 6, 2023 15:43
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3b2caab) 99.64% compared to head (638ee4d) 99.63%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4787      +/-   ##
==========================================
- Coverage   99.64%   99.63%   -0.02%     
==========================================
  Files         381      381              
  Lines       34302    34048     -254     
==========================================
- Hits        34181    33924     -257     
- Misses        121      124       +3     
Files Coverage Δ
pennylane/transforms/batch_transform.py 96.03% <100.00%> (+0.03%) ⬆️
pennylane/transforms/compile.py 100.00% <ø> (ø)
pennylane/transforms/defer_measurements.py 100.00% <100.00%> (ø)
pennylane/transforms/op_transforms.py 100.00% <100.00%> (ø)
pennylane/transforms/qfunc_transforms.py 90.74% <100.00%> (+0.74%) ⬆️

... and 42 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trbromley trbromley added the bug 🐛 Something isn't working label Nov 6, 2023
@mudit2812 mudit2812 requested review from timmysilv and lillian542 and removed request for a team November 6, 2023 18:03
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautifully simple!

Copy link
Contributor

@lillian542 lillian542 left a 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! 🚀

@mudit2812 mudit2812 merged commit 3af6356 into master Nov 6, 2023
@mudit2812 mudit2812 deleted the meas-reuse branch November 6, 2023 21:31
timmysilv pushed a commit that referenced this pull request Nov 8, 2023
…uit measurements (#4787)

**Context:**
When making terminal measurements on wires with mid-circuit
measurements, the circuit was not being transformed correctly. This PR
fixes that.

**Description of the Change:**
Wires are considered to be reused by `defer_measurements` when a
measured wire has operators *and* terminal measurements applied to it
after mid-circuit measurements.

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-49507]
timmysilv added a commit that referenced this pull request Nov 8, 2023
**Context:**
These three bugs were identified as good to be released in a bugfix.

**Description of the Change:**
Cherry-pick the 3 commits to master onto this branch for the 0.33.1
bugfix release

**Benefits:**
Fixed bugs pushed out!

**Possible Drawbacks:**
Extra work in a critical time.

**Related GitHub Issues:**
#4768, #4781, #4787

---------

Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants