[Numpy-discussion] Obscure code in concatenate code path?
Daπid
davidmenhur@gmail....
Thu Sep 13 11:57:32 CDT 2012
On Thu, Sep 13, 2012 at 6:39 PM, Warren Weckesser
<warren.weckesser@enthought.com> wrote:
> I would expect an error, consistent with the behavior when 1 < axis < 32.
In that case, you are hitting the dimension limit.
np.concatenate((a,b), axis=31)
ValueError: bad axis1 argument to swapaxes
Where axis=32, axis=3500, axis=None all return the flattened array.
I have been trying with other functions and got something interesting.
With the same a, b as before:
np.sum((a,b), axis=0)
ValueError: operands could not be broadcast together with shapes (2) (3)
np.sum((a,b), axis=1)
array([[ 0. 0.], [ 2. 2. 2.]], dtype=object)
np.sum((a,b), axis=2)
ValueError: axis(=2) out of bounds
This is to be expected, but now this is not consistent:
np.sum((a,b), axis=32)
ValueError: operands could not be broadcast together with shapes (2) (3)
np.sum((a,b), axis=500)
ValueError: axis(=500) out of bounds
More information about the NumPy-Discussion
mailing list