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

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Wed May 2 11:39:41 EDT 2018


On Wed, May 2, 2018 at 6:24 AM, Hameer Abbasi <einstein.edison at gmail.com> wrote:
> There is always the option of any downstream object overriding matmul, and I
> fail to see which objects won't have a shape. - Hameer

I think we should not decide too readily on what is "reasonable" to
expect for a ufunc input. For instance, I'm currently writing a
chained-ufunc class which uses __array_ufunc__ to help make a chain
(something like `chained_ufunc = np.sin(np.multiply(Input(),
Input()))`). Here, my `Input` class defines `__array_ufunc__` but
definitely does not have a shape, and I would like to be able to
override `np.matmul` just like every other ufunc.

-- Marten


More information about the NumPy-Discussion mailing list