Skip to content

Conversation

@albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Nov 10, 2025

Context:

One of the challenges with turning autograph on by default is that it converts things it shouldn't convert into a structured for loop. When that happens, the whole program just fails and falls over.

To make things more user friendly, we instead just fall back to a standard python for loop. Less performant, but at least it works.

Description of the Change:

Fall back to standard python for loop if the capture of the jaxpr fails.

Benefits:

Things continue to run.

This fallback can be turned off by turning the qml.exceptions.CaptureWarning into an error.

Possible Drawbacks:

Things are unrolled, even if unrolled with a warning.

Related GitHub Issues:

[sc-103710]

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@albi3ro albi3ro requested a review from isaacdevlugt November 11, 2025 20:07
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.43%. Comparing base (dbdd8e4) to head (a5af99e).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8615      +/-   ##
==========================================
- Coverage   99.43%   99.43%   -0.01%     
==========================================
  Files         587      587              
  Lines       61885    61896      +11     
==========================================
+ Hits        61536    61546      +10     
- Misses        349      350       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@albi3ro albi3ro requested a review from isaacdevlugt November 12, 2025 14:25
@albi3ro albi3ro added this pull request to the merge queue Nov 12, 2025
Merged via the queue into master with commit 4c31904 Nov 12, 2025
54 checks passed
@albi3ro albi3ro deleted the control-flow-fallback branch November 12, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants