Skip to content

Conversation

@ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Aug 29, 2025

Tweak to avoid Scan rewrites being triggered when there is no single Scan Op in the graph (which happens many many times).

This avoids multiple iterations over the graph and repeated checks for isinstance(node.op, Scan), in every compilation stage. Note that all Scan rewrites are implemented as standalone in2out to enforce rewrite ordering, which means each one tries to traverse the whole graph at least once every time we compile a function.

The functionality needed (customize the rewriter created by the Equilibrium database), is something I also needed at some point elsewhere


📚 Documentation preview 📚: https://pytensor--1600.org.readthedocs.build/en/1600/

@ricardoV94
Copy link
Member Author

Failing CI seems unrelated, I suspect a new machine/system is being used in the MacOS job and it caught up with us and that annoying narrowing issue.

We should be able to use npy_intp just fine though?

@jessegrabowski
Copy link
Member

Tweak to avoid Scan rewrites being triggered when there is no single Scan Op in the graph (which happens many many times).

I've never been in that case, must be nice u_u

@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.71%. Comparing base (051b32d) to head (b065d73).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@ Coverage Diff @@ ## main #1600 +/- ## ======================================= Coverage 81.71% 81.71% ======================================= Files 230 230 Lines 52925 52931 +6 Branches 9402 9403 +1 ======================================= + Hits 43249 43255 +6  - Misses 7244 7245 +1  + Partials 2432 2431 -1 
Files with missing lines Coverage Δ
pytensor/graph/rewriting/db.py 89.31% <100.00%> (+0.04%) ⬆️
pytensor/scan/rewriting.py 83.00% <100.00%> (+0.07%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@ricardoV94 ricardoV94 merged commit 801845c into pymc-devs:main Sep 3, 2025
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment