-
Notifications
You must be signed in to change notification settings - Fork 603
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
Allow gradient transforms applied to broadcasted tapes if the broadcasted parameter(s) are not trainable #5452
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5452 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.01%
==========================================
Files 404 406 +2
Lines 37852 37590 -262
==========================================
- Hits 37728 37465 -263
- Misses 124 125 +1 ☔ View full report in Codecov by Sentry. |
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.
👍
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.
Hi @dwierichs , looks good to me :)
Context:
In #4462 we discussed the differentiation of broadcasted tapes/QNodes with gradient transforms. Due to some technical debt in the code for JVPs and due to unclear desired behaviour, applying gradient transforms to such QNodes was disallowed in #4480.
However, this also disallows applying gradient transforms to broadcasted tapes for which the broadcasted parameter(s) is/are not trainable, even though the problems discussed in #4462 do not apply in this case.
Description of the Change:
This PR lifts the restriction of applying gradient transforms to broadcasted tapes for the case that no trainable parameters are broadcasted.
The problem described in this forum post can be resolved by this, for example.
Benefits:
Unlocks gradient transforms for broadcasted tapes/QNodes as long as the broadcasting is in non-trainable parameters (which is quite common for QML applications: You want to broadcast across data points rather than trainable parameters.).
Possible Drawbacks:
Usage of
tape.trainable_params
although we don't want to rely on this property too much in the future.