-
-
Notifications
You must be signed in to change notification settings - Fork 780
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
Indexing with multidimensional boolean array and a number errors #4693
Comments
Thank you for the feedback! Currently CuPy does not have a full support for boolean masks: https://docs.cupy.dev/en/stable/overview.html
But I agree that it's better to add support for your boolean + int case as it's likely to be used frequently. |
Thanks for your work making cupy better! Yeah, I recognize that the general case is pretty challenging. I was hoping the work-around I described would point toward a possible implementation in this case. E.g. splice in an |
It seems this has been solved in CuPy v10 with #6196. I encountered this issue myself several months ago using an earlier version of CuPy. Since I recently upgraded to CuPy v10, I decided to give the boolean indexing another try for my own use case, which now also works without flaw. |
@JonathanMaes Thanks for the report! Yes, this is now implemented. |
Short description
Combining a multidimensional boolean array with other indexing causes an IndexError.
Code to reproduce
Expected behavior
Assign a bunch of zeros in the 4th elements of all innermost arrays whose 1st element is less than -1. The code above works when using numpy.
Real behavior
The following error:
Conditions
Additional context
Indexing with just the multidimensional array outputs the correct shape, so it's only when combined with other indexing that the internal understanding of its shape is incorrect. Only multi-dimensional arrays have this problem;
size=(10, 4)
is a shape that does not produce this error,size=(10, 10, 10, 4)
does.data[mask, :, 3] = 0
is effective in this case, as a workaround.data[mask, ..., 3] = 0
also works more generally.Probably related to #1512
The text was updated successfully, but these errors were encountered: