Skip to content

Bug: Array API capabilities() should not advertise boolean indexing #876

@crusaderky

Description

@crusaderky
Contributor

New in sparse 0.17.0:

>>> import sparse
>>> sparse.__array_namespace_info__().capabilities()
{'boolean indexing': True, 'data-dependent shapes': True, 'max dimensions': 63}

This is not correct.
The Array API defines boolean indexing as x[idx], where both x and idx are arrays.
However, sparse exclusively allows for boolean indexing when idx is an ArrayLike or a numpy array, which is out of the scope of the Array API - the expectation is that all arrays involved in a function belong to the same namespace, with exceptions on specific integration points (buffer interface in asarray, __dlpack__).

Until sparse can accept a sparse boolean index, capabilities should return {'boolean indexing': False, ...}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorneeds triageIssue has not been confirmed nor labeled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @crusaderky

      Issue actions

        Bug: Array API `capabilities()` should not advertise boolean indexing · Issue #876 · pydata/sparse