-
Notifications
You must be signed in to change notification settings - Fork 132
Fix bug in local_blockwise_advanced_inc_subtensor #1405
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
Fix bug in local_blockwise_advanced_inc_subtensor #1405
Conversation
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.
Pull Request Overview
This PR fixes a bug in the local_blockwise_advanced_inc_subtensor functionality and extends test coverage to handle cases with both batched and unbatched core_y.
- Updated the test for local_blockwise_advanced_inc_subtensor with a new parameter (core_y_implicitly_batched) and random integer generation for improved variation.
- Modified the subtensor rewriting function to automatically apply expand_dims on y when necessary and adjusted symbolic index extraction.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/tensor/rewriting/test_subtensor.py | Extended test scenarios to cover both implicit batching and non-batching for core_y, refactoring expected behavior using a unified inplace function. |
pytensor/tensor/rewriting/subtensor.py | Fixed bug in handling implicit dimensions by introducing expand_dims for y, and updated the extraction of symbolic indices accordingly. |
symbolic_idxs = x[tuple(new_idxs)].owner.inputs[1:] | ||
x_view = x[tuple(new_idxs)] | ||
|
||
# We need to introduce any implicit expand_dims on core dimension of y |
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.
[nitpick] Consider expanding the comment to clarify why x_view is obtained and used for reassigning symbolic_idxs. This additional context would improve code maintainability.
Copilot uses AI. Check for mistakes.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1405 +/- ##
=======================================
Coverage 82.10% 82.10%
=======================================
Files 208 208
Lines 49576 49581 +5
Branches 8791 8792 +1
=======================================
+ Hits 40704 40709 +5
Misses 6699 6699
Partials 2173 2173
🚀 New features to boost your workflow:
|
This showed up when trying to vectorize statespace models
📚 Documentation preview 📚: https://pytensor--1405.org.readthedocs.build/en/1405/