[Numpy-discussion] heads up: gufuncs on empty arrays and NpyIter removal of empty axis
sebastian at sipsolutions.net
Sun Mar 26 09:53:51 EDT 2017
just a small heads up for gufunc hackers and low level iterator users.
We will probably very soon put in a commit into master that will allow
the removal of empty axis from NpyIter/nditer, effectively removing the
"ValueError: cannot remove a zero-sized axis from an iterator"
arr = np.zeros((100, 0))
it = np.nditer((arr,),
As a follow up step, we also allow that gufuncs may be called with
empty inner loop sizes. In some cases that may mean that your gufuncs
may need special handling for lets say:
arr = np.zeros((100, 0)) # note the 0 dimension.
If this creates problems for you, please tell, so that we can slow down
or undo the change. As an example, we have a matrix_multiply gufunc for
testing purpose, which did not zero out the output for the case of
`matrix_multiply(np.ones((10, 0)), np.ones((0, 10)))`. So this could
turn code that errored out for weird reasons into wrong results in rare
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: This is a digitally signed message part
More information about the NumPy-Discussion