-
Notifications
You must be signed in to change notification settings - Fork 205
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
[BUG]: In-place modification of ndarray does not work #711
Comments
Obviously the array is being copied when passed into the C++ function, but there is no indication of why or how. |
If dtype is specified explicitly during array creation then the function works as expected:
|
If your input array on the Python side has a different dtype, then nanobind must make an implicit conversion to be able to do the call. You can disable implicit conversions via |
This is documented, by the way: please review the ndarray part of the documentation here. |
Problem description
A C++ function accepts an ndarray and modifies it in place, but changes aren't reflected on the Python side.
If the C++ code is modified to return the input array then the function works as expected:
Reproducible example code
The text was updated successfully, but these errors were encountered: