dpctl icon indicating copy to clipboard operation
dpctl copied to clipboard

Extend linspace kernel to allow floating point parameters even for integer destination type

Open oleksandr-pavlyk opened this issue 2 years ago • 0 comments

The #1051 modified behavior of linspace outside of scope of array-API spec (presumable less common/useful combination of parameters). It is an improvement towards aligning with NumPy's behavior, but it only goes half-way (does not fix negative integers):

In [7]: np.linspace(-1.9,9.1, 13, endpoint=True, dtype=int)
Out[7]: array([-2, -1, -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9])

In [8]: dpt.linspace(-1.9,9.1, 13, endpoint=True, dtype=int)
Out[8]: usm_ndarray([-1,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9])

I think we should change C++ kernel to handle this without additional copy, but this task is not an immediate priority, in my opinion. This note is to create a new issue to make sure this does become forgotten.

Originally posted by @oleksandr-pavlyk in https://github.com/IntelPython/dpctl/issues/1051#issuecomment-1413682060

oleksandr-pavlyk avatar Feb 02 '23 12:02 oleksandr-pavlyk