[Numpy-discussion] Is this a bug?

Charles R Harris charlesr.harris at gmail.com
Tue Sep 16 15:27:32 EDT 2014


Hi All,

It turns out that gufuncs will broadcast the last dimension if it is one.
For instance, inner1d has signature `(n), (n) -> ()`, yet

In [27]: inner1d([1,1,1], [1])
Out[27]: 3

In [28]: inner1d([1,1,1], [1,1])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-28-e53e62e35349> in <module>()
----> 1 inner1d([1,1,1], [1,1])

ValueError: inner1d: Operand 1 has a mismatch in its core dimension 0, with
gufunc signature (i),(i)->() (size 2 is different from 3)


I'd think this is a bug, as the dimensions should match. Note that scalar 1
will be promoted to [1] in this case.

Thoughts?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140916/1d8bffdd/attachment.html>


More information about the NumPy-Discussion mailing list