Skip to content

Commit 74c7f6d

Browse files
committed
Make it clear in clip() that min and max also broadcast together
This was somewhat implicit, but it should be clearer now that if all three arguments are arrays that there is a three-way broadcast.
1 parent a2a6e0e commit 74c7f6d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/array_api_stubs/_2023_12/elementwise_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,9 @@ def clip(
791791
x: array
792792
input array. Should have a real-valued data type.
793793
min: Optional[Union[int, float, array]]
794-
lower-bound of the range to which to clamp. If ``None``, no lower bound must be applied. Must be compatible with ``x`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
794+
lower-bound of the range to which to clamp. If ``None``, no lower bound must be applied. Must be compatible with ``x`` and ``max`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
795795
max: Optional[Union[int, float, array]]
796-
upper-bound of the range to which to clamp. If ``None``, no upper bound must be applied. Must be compatible with ``x`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
796+
upper-bound of the range to which to clamp. If ``None``, no upper bound must be applied. Must be compatible with ``x`` and ``min`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
797797
798798
Returns
799799
-------

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,9 +792,9 @@ def clip(
792792
x: array
793793
input array. Should have a real-valued data type.
794794
min: Optional[Union[int, float, array]]
795-
lower-bound of the range to which to clamp. If ``None``, no lower bound must be applied. Must be compatible with ``x`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
795+
lower-bound of the range to which to clamp. If ``None``, no lower bound must be applied. Must be compatible with ``x`` and ``max`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
796796
max: Optional[Union[int, float, array]]
797-
upper-bound of the range to which to clamp. If ``None``, no upper bound must be applied. Must be compatible with ``x`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
797+
upper-bound of the range to which to clamp. If ``None``, no upper bound must be applied. Must be compatible with ``x`` and ``min`` (see :ref:`broadcasting`). Should have a real-valued data type. Default: ``None``.
798798
799799
Returns
800800
-------

0 commit comments

Comments
 (0)