Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,13 @@ def test_meshgrid():
assert Y.shape == Y_ij.shape
assert xp.all(Y == Y_ij)


def test_argsort_stable():
"""Verify that argsort defaults to a stable sort."""
# Bare pytorch defaults to an unstable sort, and the array_api_compat wrapper
# enforces the stable=True default.
# cf https://github.com/data-apis/array-api-compat/pull/356 and
# https://github.com/data-apis/array-api-tests/pull/390#issuecomment-3452868329

t = xp.zeros(50) # should be >16
assert xp.all(xp.argsort(t) == xp.arange(50))
Loading