-
Notifications
You must be signed in to change notification settings - Fork 607
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
Add autograph support for for
loops
#6426
base: autograph_while_loop
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## autograph_while_loop #6426 +/- ##
=======================================================
Coverage ? 99.43%
=======================================================
Files ? 458
Lines ? 42976
Branches ? 0
=======================================================
Hits ? 42734
Misses ? 242
Partials ? 0 ☔ 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.
Looks pretty good to me!
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.
LGTM! 🎸
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Context:
We added initial autograph support with custom PennyLane conversion for if/else statements in #6406, and
while
loops in #6413. This PR adds support forfor
loops as well.Description of the Change:
We add a custom PennyLane implementation for for_stmt for autograph, based on the existing Catalyst implementation.
Benefits:
We can have logic like this in a captured function:
and the resulting JAXPR will contain a for-loop instead of unrolling the entire loop.
Possible Drawbacks:
Not a drawback, per se, but this is the part of the implementation that is most "behind" catalyst in terms of feature parity. Catalyst has an option to fall back on a Python implementation that is based on queueing instead of raising an error in some circumstances. A few test are
xfailed
with a note that they are implemented in Catalyst.Relevant Shortcut Stories:
[sc-71821]