Skip to content

feat: add max rank to inspection API capabilities #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2024

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Mar 21, 2024

This PR

  • adds support for querying the maximum number of supported dimensions (i.e., the maximum array rank).
  • requires that conforming array libraries supporting an infinite number of dimensions specify the max rank as None (i.e., there is not maximum array rank), and, for those unable to support infinite dimensions, those libraries must specify a finite integer value.
  • closes: RFC: add inspection support for querying the maximum number of supported dimensions #694

@kgryte kgryte added the API extension Adds new functions or objects to the API. label Mar 21, 2024
@kgryte kgryte added this to the v2024 milestone Mar 21, 2024
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, thanks @kgryte.

I considered whether this needed to be device-specific, but unless someone has a concrete example of that being the case in an existing library, I don't think it's needed now. It's always possible to do this in the future by adding a device keyword to capabilities in the future.

Copy link
Contributor

@leofang leofang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this for v2024 only, or would we backport it?

@asmeurer
Copy link
Member

New APIs shouldn't be backported. Only things like typo fixes and clarifications that don't affect implementations should be backported to previous versions.

@kgryte
Copy link
Contributor Author

kgryte commented May 2, 2024

As this PR has received 2 approvals and no objections, I'll go ahead and merge. Any further changes can be addressed in follow-up PRs. Thanks all!

@kgryte kgryte merged commit 6a5767a into data-apis:main May 2, 2024
3 checks passed
@kgryte kgryte deleted the feat/max-rank branch May 2, 2024 04:01
@asmeurer
Copy link
Member

Since this isn't yet in a released version of the standard, I would like to propose that we rename "max rank" to something like "max dimensions". The term "rank" is ambiguous when referring to an array, since it can also refer to the linear algebra definition of rank (or even the tensor definition, which is yet another thing). I know we also use the term "rank" throughout the standard, but I would also propose that we replace this with something like "dimensionality".

@rgommers
Copy link
Member

I think that's a fair comment. "max ndim" would be another option if name length matters.

asmeurer added a commit to asmeurer/array-api that referenced this pull request May 30, 2024
@rgommers
Copy link
Member

Briefly discussed today: seemed fine to everyone to change name - @asmeurer will open a new PR.

@asmeurer
Copy link
Member

#809

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: add inspection support for querying the maximum number of supported dimensions
4 participants