[Numpy-discussion] Extending ufunc signature syntax for matmul, frozen dimensions

Matti Picus matti.picus at gmail.com
Tue May 1 03:20:57 EDT 2018


On 01/05/18 00:38, Eric Wieser wrote:
>
> I think I’m -1 on this - this just makes things harder on the 
> implementers of |_array_ufunc__| who now might have to work out which 
> signature matches. I’d prefer the solution where |np.matmul| is a 
> wrapper around one of three gufuncs (or maybe just around one with 
> axis insertion) - this is similar to how np.linalg already works.
>
> Eric
>
>>
> On Mon, 30 Apr 2018 at 14:34 Stephan Hoyer <shoyer at gmail.com 
> <mailto:shoyer at gmail.com>> wrote:
>
>     On Sun, Apr 29, 2018 at 2:48 AM Matti Picus <matti.picus at gmail.com
>     <mailto:matti.picus at gmail.com>> wrote:
>
>         The proposed solution to issue #9029 is to extend the meaning
>         of a signature so "syntax like (n?,k),(k,m?)->(n?,m?) could
>         mean that n and m are optional dimensions; if missing in the
>         input, they're treated as 1, and
>         then dropped from the output"
>
>
>     I agree that this is an elegant fix for matmul, but are there
>     other use-cases for "optional dimensions" in gufuncs?
>
>     It feels a little wrong to add gufunc features if we can only
>     think of one function that can use them.
>     _______________________________________________
>     NumPy-Discussion mailing list
>     NumPy-Discussion at python.org <mailto:NumPy-Discussion at python.org>
>     https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

I will try to prototype this solution and put it up for comment, 
alongside the multi-signature one.
Matti


More information about the NumPy-Discussion mailing list