You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How create Array from exists Memory without copy? #425
Conversions which take ownership of Rust data and transfer it over to Python use the IntoPyArray trait.
It basically supports Vec<T>, Box<[T]> and Array<T, D> where T is any of the supported element types.
If this ties in with PyO3/pyo3#4058, I could image adding support for Mmap reinterpreted as [T] to turn this into a one-dimensional NumPy array without copying which you can then reshape into the final form without copying via the usual NumPy API.
Activity
adamreichold commentedon Apr 8, 2024
Conversions which take ownership of Rust data and transfer it over to Python use the
IntoPyArraytrait.It basically supports
Vec<T>,Box<[T]>andArray<T, D>whereTis any of the supported element types.If this ties in with PyO3/pyo3#4058, I could image adding support for
Mmapreinterpreted as[T]to turn this into a one-dimensional NumPy array without copying which you can then reshape into the final form without copying via the usual NumPy API.