-
Notifications
You must be signed in to change notification settings - Fork 16
ENH: delegate kron function.
#516
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
base: main
Are you sure you want to change the base?
Conversation
|
The test fails with the I can update my delegation strategy to avoid delegating when the product of the shape elements equals zero (when using NumPy). What do you think about this? |
|
|
|
@lucascolley I'm a bit confused, even with your command, I still can't reproduce the issue. |
|
what is your Maybe |
|
Here is the information you requested: |
|
ah sorry, I meant |
|
This is the pixi list. I just want to mention that I have the same behaviour with two different computer using kubuntu. |
|
Do you have |
|
I managed to reinstall the environment using Pixi and I now have the correct pytest version, but I still can pass the test. |
|
|
After some investigation, I found the root cause of the failing tests: the issue occurs when the left input array has at least one dimension of size zero. This appears to be a bug related to an older implementation of the kron operator. I tested several NumPy versions, and the code works correctly starting from NumPy 1.23.0. It seems that the performance improvements to kron introduced in numpy/numpy#21354 resolve this issue. How would you like to proceed? |
I'm fine with just skipping the tests when |
|
This change is a bit risky because the code will fail for users running NumPy < 1.23. If feasible, we should add a runtime check to conditionally disable delegation for unsupported NumPy versions. |
ah yes, that sounds good to me too |
|
Another question I have is that I wasn’t able to reproduce the test failure on my side. (array-api-extra:tests-numpy1) francois@ordinateur:~/array-api-extra$ python3
Python 3.10.19 | packaged by conda-forge | (main, Oct 22 2025, 22:29:10) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import numpy as np
>>> np.__version__
'1.23.5'
|
|
hmmm, apparently neither! array-api-extra on 🎋 main is 📦 v0.9.2.dev0 via 🐍 v3.10.19 via 🧚 v0.60.0 (tests-numpy1)
❯ python3
Python 3.10.19 | packaged by conda-forge | (main, Oct 22 2025, 22:29:10) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.25.0.dev0+1465.g126b46c7a' |
|
so it is finding the wrong array-api-extra on 🎋 main is 📦 v0.9.2.dev0 via 🐍 v3.10.19 via 🧚 v0.60.0 (tests-numpy1)
❯ python
Python 3.10.19 | packaged by conda-forge | (main, Oct 22 2025, 22:29:10) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__file__
'/home/lucas/.local/lib/python3.10/site-packages/numpy/__init__.py'it should be picking up 1.22 on both linux and osx, though: array-api-extra on 🎋 main is 📦 v0.9.2.dev0 via 🐍 via 🧚 v0.60.0
❯ pixi ls -e tests-numpy1 numpy --platform=linux-64
Environment: tests-numpy1
Package Version Build Size Kind Source
numpy 1.22.0 py310h454958d_1 19.4 MiB conda https://prefix.dev/conda-forge/
array-api-extra on 🎋 main is 📦 v0.9.2.dev0 via 🐍 via 🧚 v0.60.0
❯ pixi ls -e tests-numpy1 numpy --platform=osx-arm64
Environment: tests-numpy1
Package Version Build Size Kind Source
numpy 1.22.0 py310h567df17_1 6 MiB conda https://prefix.dev/conda-forge/ |
|
Should we open a dedicated issue on the Pixi repository to investigate this further? |
|
a more minimal reproducer would be helpful first, I think |
This merge request introduces the
krondelegate function (#100).All supported backends already implement the
kronfunction. However, I wasn’t able to add support for the sparse backend because it requires all input sparse matrices to have a fill_value equal to zero (not the case in the test) - likely to avoid generating a large dense matrix.If you’d like to discuss potential support for kron in PyData Sparse, please let me know!
Feedback is welcome.