-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Avoid extra data copy induced by np.ravel
and np.flatten
#5555
Comments
Usage of ravel and flatten in the repo can be queried via the following commands:
Which at the current master HEAD returns 108 and 11 matches, respectively. For each match, an audit of the code is needed to figure out whether a copy is necessary. My suggestion is to divide this issue into 2 PRs, one for the 11 Another further enhancement would be to expand CI with a further test that checks for
Upon every PR commit, |
Go for it @andres-fr !
This is in fact interesting, I don't know if @scikit-image/core members are OK with such CI features... |
👍 Thanks!
Why not? I think it could be a nice CI addition, but let's roll it only once the current instances of
👍 so all instances are either updated with |
Description
Some unwanted extra data copies can be avoided when a view is needed by using
ndarray.reshape(-1)
instead ofnp.ravel
andnp.flatten
.Upd(@soupault): More info - https://stackoverflow.com/questions/28930465/what-is-the-difference-between-flatten-and-ravel-functions-in-numpy
The text was updated successfully, but these errors were encountered: