You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG __array_ufunc__ does not work well with output set on reduce, accumulate, reduceat #9105
As noted by @eric-wieser in #9104 (comment), currently __array_ufunc__ does not actually work as advertised if out is set on anything but __call__: if it is, it is turned into a tuple, but if that is passed back to the regular non-overriden ufunc, one gets an error, since those do not know how to deal with tuples.
Two possible solutions:
We break the "out is always a tuple" rule for reduce, accumulate, reduceat; if we do this, my sense would be to give up the whole tuple idea for nout=1, and just do it only for nout>1...
We allow passing in of tuples in the ufunc.reduce, ufunc.accumulate, and ufunc.reduceat methods.
I think I slightly favour option 1 even though I definitely have argued differently before.
Activity
eric-wieser commentedon May 12, 2017
outalso works fine onouter, I'd assumeeric-wieser commentedon May 12, 2017
I'd favor option 2 for consistency, I think - especially since I'd like to see
ufunc.reducebecome a gufunc somedaymhvk commentedon May 12, 2017
well, option 2 is the easier, so I'll take this as a reason to at least make a PR for it...
mhvk commentedon May 12, 2017
See #9106 for an implementation of option 2. Definitely the easier route...
mhvk commentedon May 17, 2017
closing this since a fix is now ready.