-
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
Update the state original tape device #1049
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #1049 +/- ##
=======================================
Coverage 97.74% 97.75%
=======================================
Files 153 153
Lines 11508 11512 +4
=======================================
+ Hits 11249 11253 +4
Misses 259 259
Continue to review full report at Codecov.
|
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 for the quick fix! Verified this works with the original example, as well as the demo that uncovered the bug.
"""Test that the returned state is equal to the expected returned state for all of | ||
PennyLane's built in statevector devices""" | ||
|
||
dev = qml.device(device, wires=4) | ||
|
||
@qnode(dev, diff_method="parameter-shift") | ||
@qnode(dev, diff_method=diff_method) |
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.
"best"
may cover "backprop"
too for relevant devices and tests the new behaviour.
Context:
With #1008 devices can be swapped under the hood to get the best differentiation method. This means that certain internal device data may be lost during the QNode call.
Description of the Change:
Updates the
_pre_rotated_state
and_state
private attributes of the original device with the device that was actually used during execution.Note: the way of how the state prior to rotations in being stored might not be completely unified between devices and is not a part of the shared device methods (not a member of
QubitDevice
). Therefore we are attempting to set the affected attributes, but if they do not exist then no change is done.Benefits:
States are updated even if a different device is used under the hood.
Possible Drawbacks:
None, though might provide a reason to consider a unified name for storing states in statevector simulator devices.
Related GitHub Issues:
#1048