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
The point is to avoid copy when wrapping temporaries, which typically happens the case when parsing log files here and wrapping some methods. Consider using boost::python::numpy instead raw C-Python API calls for constructing numpy object. It may be easier to expose a new take_ownership attribute for numpy converters. Otherwise, set ownership manually by doing:
Note that taking ownership it not going to be helpful if memory has been allocated on the stack and not on the heap. It should be fine for dynamic size Eigen objects but not for fixed size. Fortunately, It is easy to detect this edge-case at compile-time.
duburcqa
changed the title
[core/python] Refactor numpy converters to stop using low-level C-Python API.
[core/python] Add a way to take ownership when converting to python
Dec 8, 2023
The point is to avoid copy when wrapping temporaries, which typically happens the case when parsing log files here and wrapping some methods. Consider using
boost::python::numpy
instead raw C-Python API calls for constructing numpy object. It may be easier to expose a newtake_ownership
attribute for numpy converters. Otherwise, set ownership manually by doing:Note that taking ownership it not going to be helpful if memory has been allocated on the stack and not on the heap. It should be fine for dynamic size Eigen objects but not for fixed size. Fortunately, It is easy to detect this edge-case at compile-time.
See also for reference:
The text was updated successfully, but these errors were encountered: