-
Notifications
You must be signed in to change notification settings - Fork 588
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
Raise a deprecation warning if Operator.decomposition
is a staticmethod
#2214
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #2214 +/- ##
==========================================
+ Coverage 96.52% 99.26% +2.74%
==========================================
Files 231 231
Lines 18191 18197 +6
==========================================
+ Hits 17558 18063 +505
+ Misses 633 134 -499
Continue to review full report at Codecov.
|
"Either define the static method 'compute_decomposition' instead, or use " | ||
"'self.wires' and 'self.parameters'.", | ||
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.
Nice!
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'll just wait for the tests to pass before approving!
Thanks @mariaschuld! This requires the fix in #2218 for the tests to pass :) |
True, but I also meant the code coverage...good to test the fix? |
def decomposition(*params, wires): | ||
qml.RY(params[0], wires=wires[0]) | ||
qml.PauliZ(wires=wires[0]) | ||
qml.RX(params[1], wires=wires[0]) |
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 think we just need another case with no params here...
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.
oh oops, I didn't even spot this
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.
done!
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.
Approval conditioned on checks passing :)
Thanks Josh!
Context: As part of the recent operator refactor, the static method
Operator.decomposition
was renamed toOperator.compute_decomposition
. The newOperator.decomposition
is now an instance method.Description of the Change: Adds a deprecation warning to alert developers to this change.
Benefits: As above.
Possible Drawbacks: n/a
Related GitHub Issues: Closes #2210