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

Add squeeze(f, A, dims) for reductions to drop dims #23500

Closed
wants to merge 2 commits into from

Conversation

mbauman
Copy link
Member

@mbauman mbauman commented Aug 29, 2017

This simple definition makes it easier to write reductions that drop the dimensions over which they reduce. Fixes #16606, addresses part of the root issue in #22000.

This simple definition makes it easier to write reductions that drops the dimensions over which they reduce. Fixes #16606, addresses part of the root issue in #22000.
@ararslan ararslan added the arrays [a, r, r, a, y, s] label Aug 29, 2017
@ararslan
Copy link
Member

Bump. Good to go?

@mbauman
Copy link
Member Author

mbauman commented Sep 22, 2017

Sure. It seems like a reasonable and wanted feature.

@ararslan ararslan added the needs news A NEWS entry is required for this change label Sep 22, 2017
@mbauman
Copy link
Member Author

mbauman commented Sep 22, 2017

It's been a minute. Let's re-run CI.

@mbauman mbauman closed this Sep 22, 2017
@mbauman mbauman reopened this Sep 22, 2017
@ararslan
Copy link
Member

Just realized it should probably have a NEWS item.

@mbauman mbauman removed the needs news A NEWS entry is required for this change label Oct 12, 2017
@mbauman
Copy link
Member Author

mbauman commented Oct 12, 2017

NEWS added. This is good to go once CI passes.

@JeffBezanson
Copy link
Member

I won't block this, but it's a little odd how this definition assumes the passed function uses the A, dims argument pattern. In general you might have to write

squeeze((a,d)->reducedim(max,a,d), A, dims)

@nalimilan
Copy link
Member

Maybe it should always pass the function to reducedim?

@mbauman
Copy link
Member Author

mbauman commented Oct 13, 2017

That's a really good point. Even worse is that it would prohibit us from transitioning sum(A, region) to a keyword argument for region within 1.x. Without it, we could deprecate the non-keyword method, but this function would always have to call the non-keyword method.

@lstagner
Copy link
Contributor

lstagner commented Oct 6, 2018

What is the status of this? squeeze is now dropdims and I would very much like this feature.

@mbauman
Copy link
Member Author

mbauman commented May 5, 2020

Closing in favor of #33130.

@mbauman mbauman closed this May 5, 2020
@mbauman mbauman deleted the mb/reductioneeze branch May 5, 2020 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

array reductions (sum, mean, etc.) and dropping dimensions
6 participants