dpnp
dpnp copied to clipboard
dpnp ufuncs do not define the nin attribute
NumPy ufuncs have an attribute called nin. nin returns the number of input arguments accepted by the ufunc.
dpnp presently does not provide the attribute. The attribute is needed to compile dpnp ufuncs using numba-dpex. Numba-dpex relies on Numba's existing NumPy ufunc registry to add a JIT-able implementation of each ufunc. Numba needs the nin attribute to properly derive the ufunc signature (refer: https://github.com/numba/numba/blob/135d15047c5237f751d4b81347effe2a3704288b/numba/np/npyimpl.py#L497)
For the time being, we are monkey-patching dpnp to add a nin attribute based on NumPy when registering dpnp ufuncs with numba-dpex.
@diptorupd
We are going to implement nin into dpctl, and then it will be available to dpnp and Numba-dpex.