-
Notifications
You must be signed in to change notification settings - Fork 569
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
Deprecate fancy decorator syntax in batch transforms #4457
Conversation
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 that. Just a couple of comments
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4457 +/- ##
=======================================
Coverage 99.65% 99.65%
=======================================
Files 376 376
Lines 33135 33142 +7
=======================================
+ Hits 33022 33029 +7
Misses 113 113
☔ View full report in Codecov by Sentry. |
Co-authored-by: Christina Lee <christina@xanadu.ai>
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.
@trbromley @rmoyard What do we think of always advertising using keyword arguments instead of using positional arguments?
@partial(qml.transforms.batch_params, all_operations=True)
@qml.qnode()
...
It removes all of this ambiguity around positional arguments.
No problems with advertising kwargs 👍 |
can you add a test or two that uses the |
Co-authored-by: Romain Moyard <rmoyard@gmail.com>
**Context:** Currently we allow the user to do something like ```python @qml.batch_input(argnum=0) @qml.qnode(dev) def circuit(inputs): ... ``` The only reason this works is because of some custom magic in `qml.batch_transform` that wraps the arguments in a `partial` call and returns that wrapper. With the new transform program we want to switch to using the following syntax: ```python @partial(qml.batch_input, argnum=0) @qml.qnode(dev) def circuit(inputs): ... ``` which works identically but is easier to understand directly from the documentation of `qml.batch_input`. **Description of the Change:** - Add deprecation warning for the use of the first syntax - Allow the first syntax in the new transform API so that existing batch transforms can be ported over without breaking things **Benefits:** Less confusing **Possible Drawbacks:** Slightly more typing for users --------- Co-authored-by: Romain Moyard <rmoyard@gmail.com> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Context:
Currently we allow the user to do something like
The only reason this works is because of some custom magic in
qml.batch_transform
that wraps the arguments in apartial
call and returns that wrapper.With the new transform program we want to switch to using the following syntax:
which works identically but is easier to understand directly from the documentation of
qml.batch_input
.Description of the Change:
Benefits:
Less confusing
Possible Drawbacks:
Slightly more typing for users