Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions array_api_strict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
from ._data_type_functions import (
astype,
broadcast_arrays,
broadcast_shapes,
broadcast_to,
can_cast,
finfo,
Expand All @@ -84,6 +85,7 @@
__all__ += [
"astype",
"broadcast_arrays",
"broadcast_shapes",
"broadcast_to",
"can_cast",
"finfo",
Expand Down
12 changes: 11 additions & 1 deletion array_api_strict/_data_type_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
_signed_integer_dtypes,
_unsigned_integer_dtypes,
)
from ._flags import get_array_api_strict_flags
from ._flags import get_array_api_strict_flags, requires_api_version


# Note: astype is a function, not an array method as in NumPy.
Expand Down Expand Up @@ -62,6 +62,16 @@ def broadcast_arrays(*arrays: Array) -> list[Array]:
]


@requires_api_version("2025.12")
def broadcast_shapes(*shapes: tuple[int, ...]) -> tuple[int, ...]:
"""
Array API compatible wrapper for :py:func:`np.broadcast_shapes <numpy.broadcast_shapes>`.

See its docstring for more information.
"""
return np.broadcast_shapes(*shapes)


def broadcast_to(x: Array, /, shape: tuple[int, ...]) -> Array:
"""
Array API compatible wrapper for :py:func:`np.broadcast_to <numpy.broadcast_to>`.
Expand Down
Loading