Skip to content

Clarify expected results for any and all when operating on empty arrays #388

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

Merged
merged 2 commits into from
Feb 16, 2022

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Feb 7, 2022

This PR

  • adds explicit guidance for any and all when operating on empty arrays. For the former, the test result should be False and, for the latter, the test result should be True. This matches both NumPy et al behavior (np.any and np.all), TF behavior (tf.reduce_any and tf.reduce_all), and Python behavior (any and all).
  • adds a note for both any and all that +-inf and NaN all evaluate to True.

@kgryte kgryte added Maintenance Bug fix, typo fix, or general maintenance. API change Changes to existing functions or objects in the API. labels Feb 7, 2022
Copy link
Member

@honno honno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

While you don't need to specifically note 0-sided dimensions (as the array would be empty anyway), I guess it probably is worth it.

@kgryte
Copy link
Contributor Author

kgryte commented Feb 16, 2022

Thanks, @honno!

@kgryte kgryte merged commit a890906 into main Feb 16, 2022
@kgryte kgryte deleted the any-all-empty-arrays branch February 16, 2022 18:04
@kgryte kgryte added this to the v2021 milestone Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change Changes to existing functions or objects in the API. Maintenance Bug fix, typo fix, or general maintenance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants