-
Notifications
You must be signed in to change notification settings - Fork 130
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
Provide static output shape for constant arange
#1302
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1302 +/- ##
==========================================
+ Coverage 81.99% 82.00% +0.01%
==========================================
Files 188 188
Lines 48553 48483 -70
Branches 8673 8666 -7
==========================================
- Hits 39812 39760 -52
+ Misses 6579 6575 -4
+ Partials 2162 2148 -14
🚀 New features to boost your workflow:
|
pytensor/tensor/basic.py
Outdated
assert start.ndim == 0 | ||
assert stop.ndim == 0 | ||
assert step.ndim == 0 | ||
|
||
shape = (None,) |
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.
NIT: put this in an else
branch
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.
I guess it would become a bit more readable that way, will make this change
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 good, just a nitpick, that we don't need to address if you don't agree
arange
to directly determine the shape from the arguments if possiblearange
Thanks @Abhinav-Khot |
Description
Modified
arange
such that in scenarios where we are able to infer the shape from the arguments i.e the arguments are constant,type.shape
is updated accordingly.For example :
Tests are also added to test the new addition.
Related Issue
pt.arange(int)
has.type.shape
set toNone
#1301Checklist
Type of change
📚 Documentation preview 📚: https://pytensor--1302.org.readthedocs.build/en/1302/