Skip to content
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

what to do when a variable is sliced with an all False Boolean index array? #1200

Closed
jswhit opened this issue Oct 12, 2022 · 4 comments
Closed

Comments

@jswhit
Copy link
Collaborator

jswhit commented Oct 12, 2022

Current behavior:

  1. for a 1D variable an empty array is returned
  2. for multi-dim variables an opaque exception is raised.
  3. for numpy arrays, an empty array is always returned

Two potential solutions:

  1. PR Added more descriptive error message if indexing with all False bool … #1197: always return an exception with a more informative error message
  2. PR return empty array if boolean index array is all False #1198: always silently return an empty array (as numpy does)

Which one do you prefer?

@jswhit
Copy link
Collaborator Author

jswhit commented Oct 14, 2022

@dopplershift @shoyer any thoughts on this?

@shoyer
Copy link
Contributor

shoyer commented Oct 14, 2022

Returning the size zero array like NumPy feels like the right thing to do

@dopplershift
Copy link
Member

I agree, my lean was towards mirroring NumPy behavior.

@jswhit
Copy link
Collaborator Author

jswhit commented Oct 14, 2022

thanks - that's my thought as well. I will merge PR #1198 next week if we have no dissenting opinions by then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants