Skip to content

Using of Boolean scalar for slicing usm_ndarray needs work #1135

Closed
@oleksandr-pavlyk

Description

@oleksandr-pavlyk

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.

Metadata

Metadata

Labels

bugSomething isn't workingtensor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions