Closed
Description
Slicing in dpctl.tensor
behaves differently than in NumPy:
In [15]: x = dpt.arange(4)
In [16]: x[True]
Out[16]: usm_ndarray(1)
In [17]: import numpy as n
In [18]: x_np = np.arange(5)
In [19]: x_np[True]
Out[19]: array([[0, 1, 2, 3, 4]])
Moreover, x[dpt.asarray(True)]
raises ValueError
instead of behaving like Python object.
Slicing high dimensional arrays also runs into similar problems. x_2d[True]
behaves like x_2d[1]
unlike in NumPy, and x_2d[dpt.asarray(True)]
raises ValueError
.