Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Raise an IndexError when array index is not integer #1785

Copy link
Copy link
@vtavana

Description

@vtavana
Issue body actions

When index of an array is a floaing point number, NumPy raises an IndexError while dpctl returns an incorrect result.

>>> import numpy, dpctl, dpctl.tensor as dpt
>>> dpctl.__version__
'0.18.0dev0+235.gd79dae1d2f'

>>> numpy.__version__
'1.26.4'

>>> b=dpt.asarray([1+1j, 2+2j])
>>> b[0.].imag
usm_ndarray([])
 
>>> b[1.].imag
usm_ndarray([[1., 2.]])
 
>>> a=numpy.array([1+1j, 2+2j])
>>> a[0.].imag
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
 
>>> a[1.].imag
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.