Skip to content

Regression: indexing by np.int64 indices #144

Closed
@crusaderky

Description

@crusaderky

The Array API states:

An integer index must be an object satisfying operator.index (e.g., int).

Therefore, this is legal, because operator.index(np.int64(0)) works:

>>> import array_api_strict as xp
>>> import numpy as np
>>> a = xp.asarray([10, 20])
>>> a[np.int64(0)]
10

#139 broke it and caused a regression in scipy:

FAILED scipy/cluster/tests/test_vq.py::TestKMean::test_kmeans2_init[array_api_strict] - ValueError: Array indexing is only allowed when array to be indexed and all indexing arrays are on the same device.
FAILED scipy/cluster/tests/test_vq.py::TestKMean::test_kmeans2_kpp_low_dim[array_api_strict] - ValueError: Array indexing is only allowed when array to be indexed and all indexing arrays are on the same device.
FAILED scipy/cluster/tests/test_vq.py::TestKMean::test_kmeans2_kpp_high_dim[array_api_strict] - ValueError: Array indexing is only allowed when array to be indexed and all indexing arrays are on the same device.
FAILED scipy/cluster/tests/test_vq.py::TestKMean::test_kmeans_and_kmeans2_random_seed[array_api_strict] - ValueError: Array indexing is only allowed when array to be indexed and all indexing arrays are on the same device.

CC @lucyleeow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions