FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

WIP: test `top k` by ev-br · Pull Request #438 · data-apis/array-api-tests · GitHub

WIP: test top k - #438

Open
ev-br wants to merge 8 commits into
data-apis:masterfrom
ev-br:test_top_k
Open

WIP: test top k#438
ev-br wants to merge 8 commits into
data-apis:masterfrom
ev-br:test_top_k

Conversation

ev-br commented Jul 1, 2026
edited
Loading

Copy link
Copy Markdown
Member

Includes, supersedes and closes gh-274.

Add testing of top_k, per data-apis/array-api#722

Matching implementations and testing:

JuliaPoo and others added 7 commits July 1, 2026 11:33
The purpose of this PR is to continue several threads of discussion
regarding `top_k`.

This follows roughly the specifications of `top_k` in
data-apis/array-api#722, with slight modifications to the API:

```py
def topk(
    x: array,
    k: int,
    /,
    axis: Optional[int] = None,
    *,
    largest: bool = True,
) -> Tuple[array, array]:
    ...
```

Modifications:
- `mode: Literal["largest", "smallest"]` is replaced with
`largest: bool`
- `axis` is no longer a kw-only arg. This makes `torch.topk`
slightly more compatible.

The tests implemented here follows the proposed `top_k`
implementation at numpy/numpy#26666.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL