[Numpy-discussion] Allowing broadcasting of code dimensions in generalized ufuncs
Marten van Kerkwijk
m.h.vankerkwijk at gmail.com
Fri Jun 15 10:07:22 EDT 2018
The discussion on the gufunc signature enhancements seems to have stalled a
bit, but while it was going I've tried to update the NEP correspondingly.
The NEP is now merged, so can viewed more easily, at
My own quite possibly biased summary of the discussion so far is that:
1) Frozen dimensions are generally seen as a good idea; other
implementations may be possible, but are not as clear.
2) Flexible dimensions have little use beyond matmul; the main discussion
is whether there is a better way. In my opinion, the main benefit of the
current proposal is that it allows operator overrides to all work the same
way (via __array_ufunc__), independent of any assumptions about the object
that does the override (such as that it has a shape).
3) Broadcastable dimensions had less support, but mostly for lack of
examples; there now is one beyond all_equal, for which a gufunc is more
clearly the proper route: a weighted average (which has obvious extensions).
A general benefit of course is that there is actual code for all three; it
would certainly be nice if we could fully support `matmul` and `@` in 1.16.
So, the question would seem whether the NEP should be accepted or rejected
(with part acceptance of course being possible, though I note that flexible
and broadcastable share a lot of implementation, so in my opinion it is
somewhat pointless to do just one of them).
All the best,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion