-
Notifications
You must be signed in to change notification settings - Fork 70
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
No noise model reset #114
No noise model reset #114
Conversation
…nnylane-qiskit into no_reset_noise_model
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 @antalszava, however it seems that this is causing a large number of tests to fail 🤔
Are some of the tests implicitly written assuming noise models are being reset?
qml.RX(0, wires=[0]) | ||
return qml.expval(qml.PauliZ(wires=0)) | ||
|
||
assert circuit() == -1 |
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 test :)
I get two failing tests (running 0.13.0 dev for both PennyLane and PennyLane-Qiskit):
But neither of these seem to involve the noise model (at least not directly). In terms of the actual fix - my code that was previously not working due to the noise model being reset is now working as expected; the noise model persists between jobs. |
Codecov Report
@@ Coverage Diff @@
## master #114 +/- ##
==========================================
+ Coverage 97.92% 98.26% +0.34%
==========================================
Files 7 7
Lines 289 289
==========================================
+ Hits 283 284 +1
+ Misses 6 5 -1
Continue to review full report at Codecov.
|
…emove unnecessary backend def
@antalszava not sure if I missed it, but don't forget to update the changelog! |
Context
Upon device initialization, a noise model can be passed to a Qiskit Aer device by specifying the
noise_model
keyword argument. The noise model is then stored as an attribute, which is initialized toNone
and is further reset toNone
oncedev.reset
is called.PennyLane core calls
dev.reset
in certain places (e.g., as part of QNode evaluation) which eventually result in "losing" the user defined noise model.Furthermore, Qiskit Aer devices persist the options that were set for them prior. This affects consecutive device creations: e.g., devices created after a noisy device creation would also have noise be set as an option.
Changes
noide_model
attribute and moves thedev.backend.set_options
call directly toQiskitDevice.__init__
fromQiskitDevice.run
.clear_options
method forAer
backends