Move defer_measurements out of QNode construction#4432
Merged
Conversation
Contributor
Author
|
[sc-42758] |
albi3ro
reviewed
Aug 4, 2023
timmysilv
reviewed
Aug 16, 2023
Contributor
timmysilv
left a comment
There was a problem hiding this comment.
what's the status for the new device API?
Contributor
Author
The new device API already calls |
Codecov Report
@@ Coverage Diff @@
## master #4432 +/- ##
=======================================
Coverage 99.71% 99.71%
=======================================
Files 378 378
Lines 34242 34242
=======================================
Hits 34144 34144
Misses 98 98
|
timmysilv
approved these changes
Aug 17, 2023
Contributor
timmysilv
left a comment
There was a problem hiding this comment.
looks great! the new device docs are pretty straightforward with when this is run, and new devices will provide their own preprocessing function if they want to support mid-circuit measurements
albi3ro
reviewed
Aug 17, 2023
mlxd
pushed a commit
that referenced
this pull request
Aug 23, 2023
* Moved defer_measurements to device * Updated changelog * Update pennylane/_device.py * Fix error * Added test * Linting * Fixed tests * Updated tests * Added small integration test * [skip ci] Added new test * [skip ci] linting --------- Co-authored-by: Christina Lee <christina@xanadu.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context:
Currently
QNodeunconditionally applies thedefer_measurementstransform during construction. This should change so that devices that support native mid-circuit measurements can use their capabilities.Description of the Change:
defer_measurementstransform fromQNode.construct.defer_measurementstransform step toqml.Device.batch_transformfor devices that don't support mid-circuit measurements natively.Benefits:
defer_measurementsis not applied unconditionally, allowing devices with native mid-circuit measurement support to define the behaviour without being able to use it.Possible Drawbacks:
Related GitHub Issues: