Skip to content
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

Use NumPy C API to perform DimShuffle steps in its C implementation #701

Merged

Conversation

brandonwillard
Copy link
Member

This PR replaces the custom view array creation in DimShuffle's C implementation with calls to NumPy's C API that match the Python implementation. It also replaces the manual shape creation steps in Reshape's C implementation with a call to a NumPy helper function.

Closes #699

@brandonwillard brandonwillard force-pushed the fix-dimshuffle-views-c-code branch from bf785ac to 4d7c16b Compare December 15, 2021 03:22
@brandonwillard brandonwillard self-assigned this Dec 15, 2021
@brandonwillard brandonwillard added bug Something isn't working important labels Dec 15, 2021
@brandonwillard brandonwillard force-pushed the fix-dimshuffle-views-c-code branch from 4d7c16b to a06fbe0 Compare December 15, 2021 03:27
These changes remove the stride-based manual computation of the new shape, since
those are potentially sensitive to broadcasted arrays with no strides.
@brandonwillard brandonwillard force-pushed the fix-dimshuffle-views-c-code branch from ea60b35 to d648969 Compare December 15, 2021 19:33
@codecov
Copy link

codecov bot commented Dec 15, 2021

Codecov Report

Merging #701 (a119a25) into main (79961a6) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #701      +/-   ##
==========================================
- Coverage   77.66%   77.66%   -0.01%     
==========================================
  Files         152      152              
  Lines       46973    46961      -12     
  Branches    10894    10891       -3     
==========================================
- Hits        36480    36470      -10     
+ Misses       7895     7894       -1     
+ Partials     2598     2597       -1     
Impacted Files Coverage Δ
aesara/link/jax/dispatch.py 80.27% <100.00%> (ø)
aesara/link/numba/dispatch/elemwise.py 97.78% <100.00%> (ø)
aesara/tensor/elemwise.py 87.13% <100.00%> (+0.16%) ⬆️
aesara/tensor/inplace.py 100.00% <100.00%> (ø)
aesara/tensor/shape.py 88.20% <100.00%> (-0.21%) ⬇️

@brandonwillard brandonwillard merged commit 9b78786 into aesara-devs:main Dec 15, 2021
@brandonwillard brandonwillard deleted the fix-dimshuffle-views-c-code branch December 15, 2021 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C-backend important
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DimShuffle's C code does not correctly handle ndarray views
2 participants