question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array objects of arbitrary rank are infeasible - require a reasonable range of ranks instead

See original GitHub issue

https://github.com/data-apis/array-api/blob/main/spec/API_specification/array_object.rst#17 says:

Furthermore, a conforming implementation of the array API standard must support array objects of arbitrary rank N (i.e., number of dimensions), where N is greater than or equal to zero.

Unfortunately this is infeasible: on any computer there’s going to be a finite maximum dimensionality, and in practice it’s usually much smaller - e.g. numpy.array_api is limited to 32-dimensional arrays. When it’s impossible to comply with the standard, implementations will quite reasonably choose whatever noncompliant option makes sense for them.

I’d therefore propose that this should instead require implementations to support arrays with between zero and 32 dimensions inclusive (or another reasonable constant TBD), and permit implementations to support a larger number of dimensions if they wish.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:18 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
leofangcommented, Sep 22, 2022

IIRC we explicitly mentioned “zero” out of the potential concern that 0D arrays are excluded in certain array libraries. We should just spell it out?

Furthermore, a conforming implementation of the array API standard must support array objects of rank N (i.e., number of dimensions), including N=0, 1, 2, 3 and 4, and document their maximum supported rank N.

2reactions
Zac-HDcommented, Sep 21, 2022

As mentioned above, this is not true. PyTorch does not have this limitation, so you get at least 1 compliant library 🙂 (Update: CuPy can easily go beyond ndim=32 too)

In [6]: torch.zeros((1,)*2000)
Out[6]: ---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
...
RecursionError: maximum recursion depth exceeded while calling a Python object

Still not arbitrarily large! (I’m impressed that it handles rank-1000 though 🤯)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rank vs depth for array partitioning
RESHAPE is of unbounded rank; it applies to any array. As a final example,. ROTATE is of rank one on the right; its...
Read more >
Assign ranks to objects by values in an array of objects
The ranking should be done for each subarray, meaning a and be, and it should be done w.r.t. to the entire list of...
Read more >
Modelling rankings in R: the PlackettLuce package
This paper presents the R package PlackettLuce, which implements a generalization of the Plackett–Luce model for rankings data.
Read more >
A New Correlation Coefficient for Comparing and Aggregating ...
Abstract. We introduce a correlation coefficient that is designed to deal with a va- riety of ranking formats including those containing non-strict (i.e., ......
Read more >
GitHub - ruppysuppy/Daily-Coding-Problem-Solutions
You can modify the input array in-place and you do not need to store the results. You can simply print them out as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found