-
Notifications
You must be signed in to change notification settings - Fork 66
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
Analytic true hw simulator warning #59
Conversation
Codecov Report
@@ Coverage Diff @@
## master #59 +/- ##
==========================================
+ Coverage 99.71% 99.71% +<.01%
==========================================
Files 8 8
Lines 346 352 +6
==========================================
+ Hits 345 351 +6
Misses 1 1
Continue to review full report at Codecov.
|
from ._version import __version__ | ||
from .gates import BasisState, Rot |
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.
👍 glad the ordering here has been fixed
"is only supported on statevector backends, not on the {}. " | ||
"The obtained result is based on sampling.". | ||
format(self.backend), | ||
UserWarning) |
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.
Should we move the warning to __init__
? That way,
- It doesn't have to be repeated for
expval
andvar
, - The user will know straight away and can change it, rather than waiting for the qnode to be evaluated
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.
I first went for it to be in the __init__.py
. In that case, however, as by default analytic=True
is used and there will be warnings raised for sampling on HW simulators
|
||
from pennylane_qiskit.qiskit_device import pauli_eigs | ||
from pennylane_qiskit import AerDevice | ||
import pennylane as qml |
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.
Should this go below the import numpy
line, since it is a third party import
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.
Ran isort
on it now and got the following:
import numpy as np
import pytest
import pennylane as qml
from pennylane_qiskit import AerDevice
from pennylane_qiskit.qiskit_device import pauli_eigs
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.
👍
…om/XanaduAI/pennylane-qiskit into analytic_true_hw_simulator_warning
…itUnitary transformation (ch gate)
… for QubitUnitary transformation (ch gate)" This reverts commit 7bb7641.
@@ -134,6 +134,10 @@ class QiskitDevice(Device, abc.ABC): | |||
operations = set(_operation_map.keys()) | |||
observables = {"PauliX", "PauliY", "PauliZ", "Identity", "Hadamard", "Hermitian"} | |||
|
|||
hw_analytic_warning_message = "The analytic calculation of expectations and variances "\ |
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.
Created separate warning message for expval
and var
Adds a warning for the expectation and variance computations in the case of when the
analytic
attribute is set toTrue
on hardware simulators.