Possible generalization of gufunc keepdims for multiple outputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
#11098 introduced a keepdims argument for gufuncs for which all the inputs had the same number of core dimensions and all the outputs had none; for those, it would insert dimensions of length 1 in the outputs, i.e., a signature like (i),(i)->(),() is changed to (i),(i)->(1),(1).
In https://github.com/numpy/numpy/pull/11098#discussion_r189335102, @eric-wieser wondered whether it should also support signatures like (i),(i)->(),(i), i.e., allow outputs with the same number of dimensions as the inputs as well as those with no core dimensions. This issue is to remind us of this suggestion.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading PR #11098 and the linked discussion at discussion_r189335102 to understand the existing gufunc keepdims behavior. Compare the supported signature (i),(i)->(),() with the proposed (i),(i)->(),(i) case, then identify the relevant gufunc implementation and tests. Done means agreeing on the generalization and covering its behavior with tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100