Skip to content

Tweak rewrites in infer_shape dataset #1563

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

Merged

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Jul 29, 2025

This PR removes some inc_subtensor rewrites from infer_shape database. These don't simplify shape inference as the shape of an inc_subtensor is always the shape of the input, regardless of whether it is useless or not. They are also not very common to begin with?

Instead we add the useless_switch rewrite. We want a subset of rewrites that quickly simplify the graph and reason about the shapes introduced by infer_shape


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

They don't simplify shape inference, since the operation is never meaningful shape-wise
@ricardoV94 ricardoV94 changed the title Tweakn rewrites in infer_shape dataset Tweak rewrites in infer_shape dataset Jul 29, 2025
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.53%. Comparing base (b55c473) to head (666fe9c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1563      +/-   ##
==========================================
- Coverage   81.53%   81.53%   -0.01%     
==========================================
  Files         230      230              
  Lines       53079    53078       -1     
  Branches     9425     9425              
==========================================
- Hits        43279    43278       -1     
  Misses       7365     7365              
  Partials     2435     2435              
Files with missing lines Coverage Δ
pytensor/tensor/rewriting/basic.py 95.86% <100.00%> (+<0.01%) ⬆️
pytensor/tensor/rewriting/subtensor.py 90.25% <ø> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 merged commit 75b8ee9 into pymc-devs:main Jul 29, 2025
74 checks passed
@ricardoV94 ricardoV94 deleted the remove_rewrites_from_infer_shape branch July 29, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants