numexpr icon indicating copy to clipboard operation
numexpr copied to clipboard

sum returns wrong shape for arrays with a zero dimension

Open gerritholl opened this issue 7 years ago • 0 comments

When summing over an array that contains a dimension with length zero, numexpr.sum fails to reduce the dimensions and instead returns a result with the same shape as the input. This behaviour is inconsistent with core Python:

In [142]: z = empty(shape=(0, 10)) 

In [143]: numpy.sum(z, 1).shape
Out[143]: (0,)

In [144]: numexpr.evaluate("sum(z, 1)").shape
Out[144]: (0, 10)

gerritholl avatar Oct 12 '16 15:10 gerritholl