-
Notifications
You must be signed in to change notification settings - Fork 120
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
Adds into_pyarray to faer Mat #482
base: main
Are you sure you want to change the base?
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.
Needs CI fixing please
PyArray::from_raw_parts( | ||
py, | ||
dims, | ||
strides.as_ptr(), |
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.
@ngoldbaum does PyArray_NewFromDescr
copy the strides array or just store the pointer? This looks like a potential use-after-free 🤔
(We already have the same pattern in the other into_pyarray
functions in this file, which makes me think it's probably fine? Either that or there's a nasty bug in rust-numpy
already...)
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.
There's an explicit copy if strides are passed in:
There's another code path that handles structured dtypes with subarrays but it looks like that copies the strides too.
There's a comment here worrying about unaligned input strides:
But also I have no idea why an unaligned stride array would ever be a problem.
Looks like this has hit a build issue with |
yes, on windows x86 :/ . I don't have a good way to test on windows locally. Looks like a small change is needed in the faer-traits crate. |
Updated to the latest faer version which contains a fix for this build issue. There is a second issue, however. faer requires msrv of 1.84.0. If this is an issue, might have to either conditionally allow this optional faer feature, or, consider implementing IntoPyArray for faer Mats in faer itself |
There still seem to be issues with Windows here.
Given the seeming complexity with the CI on this end, this may be simpler (esp if faer has already implemented the reverse conversion over there). |
Interoperability with faer (https://github.com/sarah-quinones/faer-rs) Mats.
Related faer-ext PR for numpy-to-faer direction: sarah-quinones/faer-ext#6 . For bi-directional interoperability of faer with python/numpy. @sarah-quinones