-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 dropdims(f, args..; dims, kwargs..)
for reductions to drop dims
#33130
Conversation
nickrobinson251
commented
Aug 31, 2019
•
edited
Loading
edited
- attempts to address array reductions (sum, mean, etc.) and dropping dimensions #16606 (with @StefanKarpinski's suggestion array reductions (sum, mean, etc.) and dropping dimensions #16606 (comment))
- builds on @mbauman's earlier work (Add squeeze(f, A, dims) for reductions to drop dims #23500)
This simple definition makes it easier to write reductions that drops the dimensions over which they reduce. Fixes JuliaLang#16606, addresses part of the root issue in JuliaLang#22000.
dropdims(f, args..; dims, kwargs..)
for reductions to drop dims #4dropdims(f, args..; dims, kwargs..)
for reductions to drop dims
29945f3
to
c40a6fb
Compare
As far as I can tell, test failures are unrelated 🤞 |
Docstring needs to be included in the manual, and also add a compat annotation. |
thanks for the help! We already have We don't have anything in the Manual section of the docs - which I think is what you meant - where should I add something? |
Okay, thats what I meant. I thought this was a new name. |
c4c2419
to
f8e9ac5
Compare
f8e9ac5
to
68d0c29
Compare
pinging a few people who may be interested and (time allowing) well placed to review or recommend someone to review: @StefanKarpinski @mbauman @oxinabox @tpapp |
I am wondering if making FWIW, I think the right approach is something like https://github.com/bramtayl/JuliennedArrays.jl, but that can live in a library. |
This matches current methods for |
yes, both |
Marking for triage to have a last discussion about if this is the API we want. I kind of pushed this one through and I want others to have a chance to chime in before merging. |
I have nothing against this solution per se, but is there a compelling reason it has to live in I am asking because putting it in |
|
I agree we probably want something like this but this API seems a bit odd. |
I had also suggested that |
Yeah, I can see how the API is not ideal... If the implementation weren't so trivial perhaps we wouldn't choose it. Personally I'm not sure
I am not sure what exactly this would look like |
I think functions with keyword arguments are hard to compose (see also discussion on keyword argument |
I dunno how best to move forward with this. I feel like we're settled on wanting this functionality and the question is "do we want this pleasingly trivial implementation at the cost of a merely-okay / not-beautiful API?". Feel like a question for @StefanKarpinski / triage more generally? |
We'll discuss on triage this week, which should be Thursday at 2:15 US Eastern. |
Notes from triage. From @StefanKarpinski: one of the advantages of dropdims(sum)(a, dims=1) do x
# transform values here
end From @vtjnash: he was somewhat surprised that |
Another observation from @JeffBezanson and @vtjnash is that while the argument was that it would be annoying to go around and add the |
I think this is a great point/idea! I just wanted to say that personally i don't forsee having any time soon to work on a bigger, better versions of this PR. But i'd love it if someone else was excited about running with this idea. |
No worries, @nickrobinson251. Thanks for the PR—sometimes these things are deeper than they may appear at first and time seems to be the only recipe for understanding them better. |
Bump, I want this. It would make my codebase less ugly. |
closing, as i've no time to work on this (someone else is very welcome to take over if they see some value here), but also in favour of #32310 |