|
15 | 15 | is_torch_namespace, |
16 | 16 | ) |
17 | 17 | from ._lib._utils._compat import device as get_device |
18 | | -from ._lib._utils._helpers import asarrays, eager_shape |
| 18 | +from ._lib._utils._helpers import asarrays, deprecated, eager_shape |
19 | 19 | from ._lib._utils._typing import Array, DType |
20 | 20 |
|
21 | 21 | __all__ = [ |
@@ -83,19 +83,23 @@ def atleast_nd(x: Array, /, *, ndim: int, xp: ModuleType | None = None) -> Array |
83 | 83 | return _funcs.atleast_nd(x, ndim=ndim, xp=xp) |
84 | 84 |
|
85 | 85 |
|
| 86 | +@deprecated( |
| 87 | + "`xpx.broadcast_shapes` is deprecated and will be removed in v1.0.0. " |
| 88 | + "`xp.broadcast_shapes` exists in the standard as of v2025.12." |
| 89 | +) |
86 | 90 | def broadcast_shapes( |
87 | 91 | *shapes: tuple[float | None, ...], xp: ModuleType | None = None |
88 | 92 | ) -> tuple[int | None, ...]: |
89 | 93 | """ |
90 | 94 | Compute the shape of the broadcasted arrays. |
91 | 95 |
|
| 96 | + .. deprecated:: 0.11.0 |
| 97 | + :func:`broadcast_shapes` is deprecated and will be removed in v1.0.0. |
| 98 | + :func:`array_api.broadcast_shapes` exists in the standard as of v2025.12. |
| 99 | +
|
92 | 100 | Duplicates :func:`numpy.broadcast_shapes`, with additional support for |
93 | 101 | None and NaN sizes. |
94 | 102 |
|
95 | | - This is equivalent to ``xp.broadcast_arrays(arr1, arr2, ...)[0].shape`` |
96 | | - without needing to worry about the backend potentially deep copying |
97 | | - the arrays. |
98 | | -
|
99 | 103 | Parameters |
100 | 104 | ---------- |
101 | 105 | *shapes : tuple[int | None, ...] |
@@ -300,18 +304,25 @@ def create_diagonal( |
300 | 304 | return _funcs.create_diagonal(x, offset=offset, xp=xp) |
301 | 305 |
|
302 | 306 |
|
| 307 | +@deprecated( |
| 308 | + "`xpx.expand_dims` is deprecated and will be removed in v1.0.0. " |
| 309 | + "`xp.expand_dims` with support for a tuple of ints in `axis` " |
| 310 | + "exists in the standard as of v2025.12." |
| 311 | +) |
303 | 312 | def expand_dims( |
304 | 313 | a: Array, /, *, axis: int | tuple[int, ...] = (0,), xp: ModuleType | None = None |
305 | 314 | ) -> Array: |
306 | 315 | """ |
307 | 316 | Expand the shape of an array. |
308 | 317 |
|
| 318 | + .. deprecated:: 0.11.0 |
| 319 | + :func:`expand_dims` is deprecated and will be removed in v1.0.0. |
| 320 | + :func:`array_api.expand_dims` with support for a tuple of ints in `axis` |
| 321 | + exists in the standard as of v2025.12. |
| 322 | +
|
309 | 323 | Insert (a) new axis/axes that will appear at the position(s) specified by |
310 | 324 | `axis` in the expanded array shape. |
311 | 325 |
|
312 | | - This is ``xp.expand_dims`` for `axis` an int *or a tuple of ints*. |
313 | | - Roughly equivalent to ``numpy.expand_dims`` for NumPy arrays. |
314 | | -
|
315 | 326 | Parameters |
316 | 327 | ---------- |
317 | 328 | a : array |
@@ -804,7 +815,7 @@ def searchsorted( |
804 | 815 | Find the indices into a sorted array ``x1`` such that if the elements in ``x2`` |
805 | 816 | were inserted before the indices, the resulting array would remain sorted. |
806 | 817 |
|
807 | | - The behavior of this function is similar to that of `array_api.searchsorted`, |
| 818 | + The behavior of this function is similar to that of :func:`array_api.searchsorted`, |
808 | 819 | but it relaxes the requirement that `x1` must be one-dimensional. |
809 | 820 | This function is vectorized, treating slices along the last axis |
810 | 821 | as elements and preceding axes as batch (or "loop") dimensions. |
@@ -1220,8 +1231,8 @@ def isin( |
1220 | 1231 | """ |
1221 | 1232 | Determine whether each element in `a` is present in `b`. |
1222 | 1233 |
|
1223 | | - Return a boolean array of the same shape as `a` that is True for elements |
1224 | | - that are in `b` and False otherwise. |
| 1234 | + This is :func:`array_api.isin`, with additional `assume_unique` |
| 1235 | + and `kind` parameters. |
1225 | 1236 |
|
1226 | 1237 | Parameters |
1227 | 1238 | ---------- |
|
0 commit comments