diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2020-05-11 16:26:05 -0500 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2020-05-11 18:42:14 -0500 |
commit | 7f8dc86765f6f52e45126c3d7c80ac00eb01d271 (patch) | |
tree | b40602390b0e565074f9fb4e16b578030b39d36f /numpy/array_api/_elementwise_functions.py | |
parent | 07ea525dd627ee593591ae18c6d6599d943ca116 (diff) | |
download | numpy-7f8dc86765f6f52e45126c3d7c80ac00eb01d271.tar.gz |
ENH: Allow specifying reduction axis in nditer/NpyIter
A reduction axis can be a broadcast axis (-1), which does not
exist. Or an existing axis which then must have a length of 1, or
will be allocated with a length of 1.
This allows the correct allocation of reduction outputs with
axes of size 1 (instead of only newaxis/-1), i.e. it allows
supporting the result output with `keepdims=True` in reductions.
It can also be used by generalized ufuncs to specific that one
operand does not need to iterate a core dimensions. In the case
of generalized ufuncs, this is handled like a reduce dimensions,
but that dimension is later removed. This means that the operand
can be specified without read-write.
It mainly is necessary to allow normal broadcasting for the axes
_not_ marked as reduce axis.
In most cases however, an operand should never use broadcasting
when marking axes as reduction.
Diffstat (limited to 'numpy/array_api/_elementwise_functions.py')
0 files changed, 0 insertions, 0 deletions