-
Notifications
You must be signed in to change notification settings - Fork 129
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
Reuse output of Join in C backend #1340
base: main
Are you sure you want to change the base?
Conversation
d8efc2f
to
9b81d41
Compare
c6536ac
to
deb4a19
Compare
81e22db
to
4d3f133
Compare
4d3f133
to
948977d
Compare
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (97.29%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1340 +/- ##
=======================================
Coverage 82.02% 82.03%
=======================================
Files 203 203
Lines 48845 48806 -39
Branches 8691 8677 -14
=======================================
- Hits 40067 40038 -29
+ Misses 6627 6622 -5
+ Partials 2151 2146 -5
🚀 New features to boost your workflow:
|
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.
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
tests/tensor/test_basic.py:1766
- The exception expectation was changed from IndexError to ValueError. Please verify that all related code and tests are updated accordingly.
with pytest.raises(ValueError):
pytensor/tensor/basic.py:2415
- The error message for out‐of‐bounds axis errors has been updated to match numpy's standard. Confirm that this change is intentional and that no downstream dependencies rely on the old message.
numpy.exceptions.AxisError: axis 2 is out of bounds for array of dimension 2
pytensor/link/numba/dispatch/tensor_basic.py:122
- Switching to axis.item() assumes the axis input is a 0-d array; please ensure that all cases (including negative axes and non-array types) are correctly handled by this update.
return np.concatenate(tensors, axis.item())
Do not normalize constant axis in make_node and fix rewrite that assumed this would always be positive
948977d
to
2e0c79d
Compare
When GC is disabled we can get a meaningful speedup by managing the copy to the output buffer ourselves instead of using
PyArray_CONCATENATE
which doesn't allow passing an output.I didn't circumnvent
PyArray_CONCATENATE
altogether because numpy has clever logic to allocate the output array so that strides are as aligned with the inputs as possible. Copying this logic to the case where we can't reuse the buffer would add quite some complexity to our codebase.Also simplified the implementation by removing the exotic
view_flag
, which closes #753Benchmark with new test
Before
After
📚 Documentation preview 📚: https://pytensor--1340.org.readthedocs.build/en/1340/