| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…mpygh-18560) * Fixed keyword bug * Added test case * Reverted to original notation * Added tests for var and std Closes numpygh-18552
| Back | FazBrowse Home | New Git URL |
Backport of #18560.
Addresses #18552
I've managed to fix where keyword issue by refactoring those if statements.
So the rcount is a scalar when where is not provided as we reduce equal number of elements for given axis (or axes). So the first and statement prevents from illegal comparison of array to 0 value that caused original error. If the where clause is provided and rcount is an array (as we might want to reduce different number of elements along axis due to masking) then we check second and statement if any of those reduce groups are zero. I also maintained this micro-optimization to avoid calling _any(rcount == 0) when where is True and not zero.
Is this correct?
Also I had to change umr_any to _any as I think there is another bug there (or umr_any shouldn't be used there). np.any without axis parameter evaluates to scalar value (that can be used in if statement). But umr_any does not behave that way - it only reduces one dimension. Here's code for reproducing:
Here's a colab reproduction: https://colab.research.google.com/drive/1UJi6E50zzaLu2nZQWMEFHPLZnq2v6pzT?usp=sharing
Thank you for any help!
Fixed keyword bug
Added test case
Reverted to original notation
Added tests for var and std
Closes gh-18552