-
Notifications
You must be signed in to change notification settings - Fork 619
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
[Capture] Allow higher order primitives to accept dynamically shaped arrays #6786
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 #6786 +/- ##
=======================================
Coverage 99.54% 99.54%
=======================================
Files 477 478 +1
Lines 45246 45296 +50
=======================================
+ Hits 45042 45092 +50
Misses 204 204 ☔ 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.
Left a few minor comments, but I have questions about determine_abstract_axes
😅
I need some help understanding what is going on, it would probably be easiest just to chat.
Co-authored-by: lillian542 <[email protected]>
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. It seems clear to me that "dynamic shapes" at this point refers to dynamic axis sizes, but the number of dimensions cannot be dynamic? Let me know if I'm misinterpreting. If not, probably worth noting that in the markdown file.
@mudit2812 Yes, the number of dimensions cannot be dynamic. Only the size of the dimensions. |
Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Mudit Pandey <[email protected]>
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 great! Just a few final clean up related comments, otherwise I'm happy to approve.
Co-authored-by: Mudit Pandey <[email protected]>
**Context:** In [PL PR #6786](PennyLaneAI/pennylane#6786), I added additional kwargs for the for, while, and cond primitives for handling inputs with abstract shapes. Those inputs broken the custom registrations for the lightning interpreter. **Description of the Change:** Import the `FlattenedHigherOrderPrimitives` to get default behavior for for, while, and cond. These should better stay updated with changes to the primitives and the base class. **Benefits:** Lightning works again. **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: ringo-but-quantum <[email protected]>
Context:
By turning on the experimental
jax_dynamic_shapes
mode, you can capture and compile jaxpr for a series of different shapes at the same time. While this expermental feature has issues and isn't fully supported by jax yet, it is used by catalyst. To continue to support all of catalyst's features, we need to be able to capture and work with dynamic shapes as well.Description of the Change:
qml.capture.determine_abstracted_axes
function to determine the requiredabstracted_axes
and the corresponding abstract shapes.determine_abstracted_axes
function in all of our higher order primitives other thangrad
andjacobian
, asgrad
andjacobian
may prove more complicated.Benefits:
Our higher order primitives can accept inputs with abstract shapes.
Possible Drawbacks:
This jax mode is still experimental.
Related GitHub Issues:
[sc-81471]