Skip to content

Conversation

@ev-br
Copy link
Member

@ev-br ev-br commented Nov 17, 2025

This is a proposed 2025.12 feature, cf data-apis/array-api#982

  1. TBD: two separate tests (_searchsorted and _searchsorted_with_scalars) or fold into a single function.
  2. needs a rebase on expand testing of searchsorted #393 done
  3. needs implementing in array_api_strict : ENH: searchorted: support int | float scalar x2 array-api-strict#170
  4. On CuPy: needs a -compat update: ENH: cupy: add a workaround for cp.searchorted 2nd argument array-api-compat#374
  5. Dask: fails, needs an xfail : TST: dask: xfail searchorted_scalars test on dask array-api-compat#375

@ev-br ev-br marked this pull request as draft November 17, 2025 17:34
@ev-br ev-br force-pushed the searchsorted_scalars branch 2 times, most recently from 17bfa05 to 61a770f Compare November 17, 2025 19:00
@ev-br ev-br force-pushed the searchsorted_scalars branch from 61a770f to de3623c Compare December 2, 2025 20:27
@ev-br ev-br force-pushed the searchsorted_scalars branch 2 times, most recently from d113409 to 37b4e32 Compare January 8, 2026 18:54
@ev-br ev-br force-pushed the searchsorted_scalars branch from 37b4e32 to 4890591 Compare January 8, 2026 18:59
@ev-br
Copy link
Member Author

ev-br commented Jan 8, 2026

Local testing:

$ ARRAY_API_TESTS_SKIP_DTYPES=uint16,uint32,uint64 ARRAY_API_TESTS_MODULE=array_api_compat.torch pytest array_api_tests/test_searching_functions.py::test_searchsorted_with_scalars --max-examples 50_000 

OK

$ ARRAY_API_TESTS_MODULE=array_api_compat.numpy pytest array_api_tests/test_searching_functions.py::test_searchsorted_with_scalars --max-examples 50_000 

OK

$ ARRAY_API_TESTS_MODULE=array_api_compat.dask.array pytest array_api_tests/test_searching_functions.py::test_searchsorted_with_scalars --max-examples 500 

>       meta = np.searchsorted(a._meta, v._meta)
                                        ^^^^^^^
E       AttributeError: 'int' object has no attribute '_meta'
E       
E       ========== FAILING CODE SNIPPET:
E       xp.searchsorted(dask.array<sort, shape=(1,), dtype=uint8, chunksize=(1,), chunktype=numpy.ndarray>, 0, sorter=None, **kw) with kw = {}
E       ====================


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.

1 participant