`_ for each stacked matrix.
+
+ The returned array must have a data type determined by :ref:`type-promotion`.
+
+
+ **Raises**
+
+ - if either ``x1`` or ``x2`` is a zero-dimensional array.
+ - if ``x1`` is a one-dimensional array having shape ``(K,)``, ``x2`` is a one-dimensional array having shape ``(L,)``, and ``K != L``.
+ - if ``x1`` is a one-dimensional array having shape ``(K,)``, ``x2`` is an array having shape ``(..., L, N)``, and ``K != L``.
+ - if ``x1`` is an array having shape ``(..., M, K)``, ``x2`` is a one-dimensional array having shape ``(L,)``, and ``K != L``.
+ - if ``x1`` is an array having shape ``(..., M, K)``, ``x2`` is an array having shape ``(..., L, N)``, and ``K != L``.
+ """
+
+
+def matrix_transpose(x: array, /) -> array:
+ """
+ Transposes a matrix (or a stack of matrices) ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array having shape ``(..., M, N)`` and whose innermost two dimensions form ``MxN`` matrices.
+
+ Returns
+ -------
+ out: array
+ an array containing the transpose for each matrix and having shape ``(..., N, M)``. The returned array must have the same data type as ``x``.
+ """
+
+
+def tensordot(
+ x1: array,
+ x2: array,
+ /,
+ *,
+ axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2,
+) -> array:
+ """
+ Returns a tensor contraction of ``x1`` and ``x2`` over specific axes.
+
+ .. note::
+ The ``tensordot`` function corresponds to the generalized matrix product.
+
+ Parameters
+ ----------
+ x1: array
+ first input array. Should have a numeric data type.
+ x2: array
+ second input array. Should have a numeric data type. Corresponding contracted axes of ``x1`` and ``x2`` must be equal.
+
+ .. note::
+ Contracted axes (dimensions) must not be broadcasted.
+
+ axes: Union[int, Tuple[Sequence[int], Sequence[int]]]
+ number of axes (dimensions) to contract or explicit sequences of axes (dimensions) for ``x1`` and ``x2``, respectively.
+
+ If ``axes`` is an ``int`` equal to ``N``, then contraction must be performed over the last ``N`` axes of ``x1`` and the first ``N`` axes of ``x2`` in order. The size of each corresponding axis (dimension) must match. Must be nonnegative.
+
+ - If ``N`` equals ``0``, the result is the tensor (outer) product.
+ - If ``N`` equals ``1``, the result is the tensor dot product.
+ - If ``N`` equals ``2``, the result is the tensor double contraction (default).
+
+ If ``axes`` is a tuple of two sequences ``(x1_axes, x2_axes)``, the first sequence must apply to ``x`` and the second sequence to ``x2``. Both sequences must have the same length. Each axis (dimension) ``x1_axes[i]`` for ``x1`` must have the same size as the respective axis (dimension) ``x2_axes[i]`` for ``x2``. Each sequence must consist of unique (nonnegative) integers that specify valid axes for each respective array.
+
+
+ .. note::
+ If either ``x1`` or ``x2`` has a complex floating-point data type, neither argument must be complex-conjugated or transposed. If conjugation and/or transposition is desired, these operations should be explicitly performed prior to computing the generalized matrix product.
+
+ Returns
+ -------
+ out: array
+ an array containing the tensor contraction whose shape consists of the non-contracted axes (dimensions) of the first array ``x1``, followed by the non-contracted axes (dimensions) of the second array ``x2``. The returned array must have a data type determined by :ref:`type-promotion`.
+ """
+
+
+def vecdot(x1: array, x2: array, /, *, axis: int = -1) -> array:
+ r"""
+ Computes the (vector) dot product of two arrays.
+
+ Let :math:`\mathbf{a}` be a vector in ``x1`` and :math:`\mathbf{b}` be a corresponding vector in ``x2``. The dot product is defined as
+
+ .. math::
+ \mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} a_i\overline{b_i}
+
+ over the dimension specified by ``axis`` and where :math:`n` is the dimension size and :math:`\overline{b_i}` denotes the complex conjugate if :math:`b_i` is complex and the identity if :math:`b_i` is real-valued.
+
+ Parameters
+ ----------
+ x1: array
+ first input array. Should have a floating-point data type.
+ x2: array
+ second input array. Must be compatible with ``x1`` for all non-contracted axes (see :ref:`broadcasting`). The size of the axis over which to compute the dot product must be the same size as the respective axis in ``x1``. Should have a floating-point data type.
+
+ .. note::
+ The contracted axis (dimension) must not be broadcasted.
+
+ axis: int
+ axis over which to compute the dot product. Must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of the shape determined according to :ref:`broadcasting`. If specified as a negative integer, the function must determine the axis along which to compute the dot product by counting backward from the last dimension (where ``-1`` refers to the last dimension). By default, the function must compute the dot product over the last axis. Default: ``-1``.
+
+ Returns
+ -------
+ out: array
+ if ``x1`` and ``x2`` are both one-dimensional arrays, a zero-dimensional containing the dot product; otherwise, a non-zero-dimensional array containing the dot products and having rank ``N-1``, where ``N`` is the rank (number of dimensions) of the shape determined according to :ref:`broadcasting` along the non-contracted axes. The returned array must have a data type determined by :ref:`type-promotion`.
+
+
+ **Raises**
+
+ - if provided an invalid ``axis``.
+ - if the size of the axis over which to compute the dot product is not the same (before broadcasting) for both ``x1`` and ``x2``.
+ """
+
+
+__all__ = ["matmul", "matrix_transpose", "tensordot", "vecdot"]
diff --git a/src/array_api_stubs/_draft/manipulation_functions.py b/src/array_api_stubs/_draft/manipulation_functions.py
new file mode 100644
index 000000000..2d7179a8b
--- /dev/null
+++ b/src/array_api_stubs/_draft/manipulation_functions.py
@@ -0,0 +1,213 @@
+from ._types import List, Optional, Tuple, Union, array
+
+
+def broadcast_arrays(*arrays: array) -> List[array]:
+ """
+ Broadcasts one or more arrays against one another.
+
+ Parameters
+ ----------
+ arrays: array
+ an arbitrary number of to-be broadcasted arrays.
+
+ Returns
+ -------
+ out: List[array]
+ a list of broadcasted arrays. Each array must have the same shape. Each array must have the same dtype as its corresponding input array.
+ """
+
+
+def broadcast_to(x: array, /, shape: Tuple[int, ...]) -> array:
+ """
+ Broadcasts an array to a specified shape.
+
+ Parameters
+ ----------
+ x: array
+ array to broadcast.
+ shape: Tuple[int, ...]
+ array shape. Must be compatible with ``x`` (see :ref:`broadcasting`). If the array is incompatible with the specified shape, the function should raise an exception.
+
+ Returns
+ -------
+ out: array
+ an array having a specified shape. Must have the same data type as ``x``.
+ """
+
+
+def concat(
+ arrays: Union[Tuple[array, ...], List[array]], /, *, axis: Optional[int] = 0
+) -> array:
+ """
+ Joins a sequence of arrays along an existing axis.
+
+ Parameters
+ ----------
+ arrays: Union[Tuple[array, ...], List[array]]
+ input arrays to join. The arrays must have the same shape, except in the dimension specified by ``axis``.
+ axis: Optional[int]
+ axis along which the arrays will be joined. If ``axis`` is ``None``, arrays must be flattened before concatenation. If ``axis`` is negative, the function must determine the axis along which to join by counting from the last dimension. Default: ``0``.
+
+ Returns
+ -------
+ out: array
+ an output array containing the concatenated values. If the input arrays have different data types, normal :ref:`type-promotion` must apply. If the input arrays have the same data type, the output array must have the same data type as the input arrays.
+
+ .. note::
+ This specification leaves type promotion between data type families (i.e., ``intxx`` and ``floatxx``) unspecified.
+ """
+
+
+def expand_dims(x: array, /, *, axis: int = 0) -> array:
+ """
+ Expands the shape of an array by inserting a new axis (dimension) of size one at the position specified by ``axis``.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axis: int
+ axis position (zero-based). If ``x`` has rank (i.e, number of dimensions) ``N``, a valid ``axis`` must reside on the closed-interval ``[-N-1, N]``. If provided a negative ``axis``, the axis position at which to insert a singleton dimension must be computed as ``N + axis + 1``. Hence, if provided ``-1``, the resolved axis position must be ``N`` (i.e., a singleton dimension must be appended to the input array ``x``). If provided ``-N-1``, the resolved axis position must be ``0`` (i.e., a singleton dimension must be prepended to the input array ``x``). An ``IndexError`` exception must be raised if provided an invalid ``axis`` position.
+
+ Returns
+ -------
+ out: array
+ an expanded output array having the same data type as ``x``.
+ """
+
+
+def flip(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None) -> array:
+ """
+ Reverses the order of elements in an array along the given axis. The shape of the array must be preserved.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis (or axes) along which to flip. If ``axis`` is ``None``, the function must flip all input array axes. If ``axis`` is negative, the function must count from the last dimension. If provided more than one axis, the function must flip only the specified axes. Default: ``None``.
+
+ Returns
+ -------
+ out: array
+ an output array having the same data type and shape as ``x`` and whose elements, relative to ``x``, are reordered.
+ """
+
+
+def permute_dims(x: array, /, axes: Tuple[int, ...]) -> array:
+ """
+ Permutes the axes (dimensions) of an array ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axes: Tuple[int, ...]
+ tuple containing a permutation of ``(0, 1, ..., N-1)`` where ``N`` is the number of axes (dimensions) of ``x``.
+
+ Returns
+ -------
+ out: array
+ an array containing the axes permutation. The returned array must have the same data type as ``x``.
+ """
+
+
+def reshape(
+ x: array, /, shape: Tuple[int, ...], *, copy: Optional[bool] = None
+) -> array:
+ """
+ Reshapes an array without changing its data.
+
+ Parameters
+ ----------
+ x: array
+ input array to reshape.
+ shape: Tuple[int, ...]
+ a new shape compatible with the original shape. One shape dimension is allowed to be ``-1``. When a shape dimension is ``-1``, the corresponding output array shape dimension must be inferred from the length of the array and the remaining dimensions.
+ copy: Optional[bool]
+ boolean indicating whether or not to copy the input array. If ``True``, the function must always copy. If ``False``, the function must never copy and must raise a ``ValueError`` in case a copy would be necessary. If ``None``, the function must reuse existing memory buffer if possible and copy otherwise. Default: ``None``.
+
+ Returns
+ -------
+ out: array
+ an output array having the same data type and elements as ``x``.
+ """
+
+
+def roll(
+ x: array,
+ /,
+ shift: Union[int, Tuple[int, ...]],
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+) -> array:
+ """
+ Rolls array elements along a specified axis. Array elements that roll beyond the last position are re-introduced at the first position. Array elements that roll beyond the first position are re-introduced at the last position.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ shift: Union[int, Tuple[int, ...]]
+ number of places by which the elements are shifted. If ``shift`` is a tuple, then ``axis`` must be a tuple of the same size, and each of the given axes must be shifted by the corresponding element in ``shift``. If ``shift`` is an ``int`` and ``axis`` a tuple, then the same ``shift`` must be used for all specified axes. If a shift is positive, then array elements must be shifted positively (toward larger indices) along the dimension of ``axis``. If a shift is negative, then array elements must be shifted negatively (toward smaller indices) along the dimension of ``axis``.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis (or axes) along which elements to shift. If ``axis`` is ``None``, the array must be flattened, shifted, and then restored to its original shape. Default: ``None``.
+
+ Returns
+ -------
+ out: array
+ an output array having the same data type as ``x`` and whose elements, relative to ``x``, are shifted.
+ """
+
+
+def squeeze(x: array, /, axis: Union[int, Tuple[int, ...]]) -> array:
+ """
+ Removes singleton dimensions (axes) from ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axis: Union[int, Tuple[int, ...]]
+ axis (or axes) to squeeze. If a specified axis has a size greater than one, a ``ValueError`` must be raised.
+
+ Returns
+ -------
+ out: array
+ an output array having the same data type and elements as ``x``.
+ """
+
+
+def stack(arrays: Union[Tuple[array, ...], List[array]], /, *, axis: int = 0) -> array:
+ """
+ Joins a sequence of arrays along a new axis.
+
+ Parameters
+ ----------
+ arrays: Union[Tuple[array, ...], List[array]]
+ input arrays to join. Each array must have the same shape.
+ axis: int
+ axis along which the arrays will be joined. Providing an ``axis`` specifies the index of the new axis in the dimensions of the result. For example, if ``axis`` is ``0``, the new axis will be the first dimension and the output array will have shape ``(N, A, B, C)``; if ``axis`` is ``1``, the new axis will be the second dimension and the output array will have shape ``(A, N, B, C)``; and, if ``axis`` is ``-1``, the new axis will be the last dimension and the output array will have shape ``(A, B, C, N)``. A valid ``axis`` must be on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x``. If provided an ``axis`` outside of the required interval, the function must raise an exception. Default: ``0``.
+
+ Returns
+ -------
+ out: array
+ an output array having rank ``N+1``, where ``N`` is the rank (number of dimensions) of ``x``. If the input arrays have different data types, normal :ref:`type-promotion` must apply. If the input arrays have the same data type, the output array must have the same data type as the input arrays.
+
+ .. note::
+ This specification leaves type promotion between data type families (i.e., ``intxx`` and ``floatxx``) unspecified.
+ """
+
+
+__all__ = [
+ "broadcast_arrays",
+ "broadcast_to",
+ "concat",
+ "expand_dims",
+ "flip",
+ "permute_dims",
+ "reshape",
+ "roll",
+ "squeeze",
+ "stack",
+]
diff --git a/src/array_api_stubs/_draft/searching_functions.py b/src/array_api_stubs/_draft/searching_functions.py
new file mode 100644
index 000000000..9393ba71e
--- /dev/null
+++ b/src/array_api_stubs/_draft/searching_functions.py
@@ -0,0 +1,101 @@
+from ._types import Optional, Tuple, array
+
+
+def argmax(x: array, /, *, axis: Optional[int] = None, keepdims: bool = False) -> array:
+ """
+ Returns the indices of the maximum values along a specified axis.
+
+ When the maximum value occurs multiple times, only the indices corresponding to the first occurrence are returned.
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued data type.
+ axis: Optional[int]
+ axis along which to search. If ``None``, the function must return the index of the maximum value of the flattened array. Default: ``None``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if ``axis`` is ``None``, a zero-dimensional array containing the index of the first occurrence of the maximum value; otherwise, a non-zero-dimensional array containing the indices of the maximum values. The returned array must have be the default array index data type.
+ """
+
+
+def argmin(x: array, /, *, axis: Optional[int] = None, keepdims: bool = False) -> array:
+ """
+ Returns the indices of the minimum values along a specified axis.
+
+ When the minimum value occurs multiple times, only the indices corresponding to the first occurrence are returned.
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued data type.
+ axis: Optional[int]
+ axis along which to search. If ``None``, the function must return the index of the minimum value of the flattened array. Default: ``None``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if ``axis`` is ``None``, a zero-dimensional array containing the index of the first occurrence of the minimum value; otherwise, a non-zero-dimensional array containing the indices of the minimum values. The returned array must have the default array index data type.
+ """
+
+
+def nonzero(x: array, /) -> Tuple[array, ...]:
+ """
+ Returns the indices of the array elements which are non-zero.
+
+ .. note::
+ If ``x`` has a complex floating-point data type, non-zero elements are those elements having at least one component (real or imaginary) which is non-zero.
+
+ .. note::
+ If ``x`` has a boolean data type, non-zero elements are those elements which are equal to ``True``.
+
+ .. admonition:: Data-dependent output shape
+ :class: admonition important
+
+ The shape of the output array for this function depends on the data values in the input array; hence, array libraries which build computation graphs (e.g., JAX, Dask, etc.) may find this function difficult to implement without knowing array values. Accordingly, such libraries may choose to omit this function. See :ref:`data-dependent-output-shapes` section for more details.
+
+ Parameters
+ ----------
+ x: array
+ input array. Must have a positive rank. If ``x`` is zero-dimensional, the function must raise an exception.
+
+ Returns
+ -------
+ out: Typle[array, ...]
+ a tuple of ``k`` arrays, one for each dimension of ``x`` and each of size ``n`` (where ``n`` is the total number of non-zero elements), containing the indices of the non-zero elements in that dimension. The indices must be returned in row-major, C-style order. The returned array must have the default array index data type.
+ """
+
+
+def where(condition: array, x1: array, x2: array, /) -> array:
+ """
+ Returns elements chosen from ``x1`` or ``x2`` depending on ``condition``.
+
+ Parameters
+ ----------
+ condition: array
+ when ``True``, yield ``x1_i``; otherwise, yield ``x2_i``. Must be compatible with ``x1`` and ``x2`` (see :ref:`broadcasting`).
+ x1: array
+ first input array. Must be compatible with ``condition`` and ``x2`` (see :ref:`broadcasting`).
+ x2: array
+ second input array. Must be compatible with ``condition`` and ``x1`` (see :ref:`broadcasting`).
+
+ Returns
+ -------
+ out: array
+ an array with elements from ``x1`` where ``condition`` is ``True``, and elements from ``x2`` elsewhere. The returned array must have a data type determined by :ref:`type-promotion` rules with the arrays ``x1`` and ``x2``.
+ """
+
+
+__all__ = ["argmax", "argmin", "nonzero", "where"]
diff --git a/src/array_api_stubs/_draft/set_functions.py b/src/array_api_stubs/_draft/set_functions.py
new file mode 100644
index 000000000..dc95f58e8
--- /dev/null
+++ b/src/array_api_stubs/_draft/set_functions.py
@@ -0,0 +1,147 @@
+from ._types import Tuple, array
+
+
+def unique_all(x: array, /) -> Tuple[array, array, array, array]:
+ """
+ Returns the unique elements of an input array ``x``, the first occurring indices for each unique element in ``x``, the indices from the set of unique elements that reconstruct ``x``, and the corresponding counts for each unique element in ``x``.
+
+ .. admonition:: Data-dependent output shape
+ :class: important
+
+ The shapes of two of the output arrays for this function depend on the data values in the input array; hence, array libraries which build computation graphs (e.g., JAX, Dask, etc.) may find this function difficult to implement without knowing array values. Accordingly, such libraries may choose to omit this function. See :ref:`data-dependent-output-shapes` section for more details.
+
+ .. note::
+ Uniqueness should be determined based on value equality (see :func:`~array_api.equal`). For input arrays having floating-point data types, value-based equality implies the following behavior.
+
+ - As ``nan`` values compare as ``False``, ``nan`` values should be considered distinct.
+ - As complex floating-point values having at least one ``nan`` component compare as ``False``, complex floating-point values having ``nan`` components should be considered distinct.
+ - As ``-0`` and ``+0`` compare as ``True``, signed zeros should not be considered distinct, and the corresponding unique element will be implementation-dependent (e.g., an implementation could choose to return ``-0`` if ``-0`` occurs before ``+0``).
+
+ As signed zeros are not distinct, using ``inverse_indices`` to reconstruct the input array is not guaranteed to return an array having the exact same values.
+
+ Each ``nan`` value and each complex floating-point value having a ``nan`` component should have a count of one, while the counts for signed zeros should be aggregated as a single count.
+
+ Parameters
+ ----------
+ x: array
+ input array. If ``x`` has more than one dimension, the function must flatten ``x`` and return the unique elements of the flattened array.
+
+ Returns
+ -------
+ out: Tuple[array, array, array, array]
+ a namedtuple ``(values, indices, inverse_indices, counts)`` whose
+
+ - first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
+ - second element must have the field name ``indices`` and must be an array containing the indices (first occurrences) of ``x`` that result in ``values``. The array must have the same shape as ``values`` and must have the default array index data type.
+ - third element must have the field name ``inverse_indices`` and must be an array containing the indices of ``values`` that reconstruct ``x``. The array must have the same shape as ``x`` and must have the default array index data type.
+ - fourth element must have the field name ``counts`` and must be an array containing the number of times each unique element occurs in ``x``. The returned array must have same shape as ``values`` and must have the default array index data type.
+
+ .. note::
+ The order of unique elements is not specified and may vary between implementations.
+ """
+
+
+def unique_counts(x: array, /) -> Tuple[array, array]:
+ """
+ Returns the unique elements of an input array ``x`` and the corresponding counts for each unique element in ``x``.
+
+ .. admonition:: Data-dependent output shape
+ :class: important
+
+ The shapes of two of the output arrays for this function depend on the data values in the input array; hence, array libraries which build computation graphs (e.g., JAX, Dask, etc.) may find this function difficult to implement without knowing array values. Accordingly, such libraries may choose to omit this function. See :ref:`data-dependent-output-shapes` section for more details.
+
+ .. note::
+ Uniqueness should be determined based on value equality (see :func:`~array_api.equal`). For input arrays having floating-point data types, value-based equality implies the following behavior.
+
+ - As ``nan`` values compare as ``False``, ``nan`` values should be considered distinct.
+ - As complex floating-point values having at least one ``nan`` component compare as ``False``, complex floating-point values having ``nan`` components should be considered distinct.
+ - As ``-0`` and ``+0`` compare as ``True``, signed zeros should not be considered distinct, and the corresponding unique element will be implementation-dependent (e.g., an implementation could choose to return ``-0`` if ``-0`` occurs before ``+0``).
+
+ Each ``nan`` value and each complex floating-point value having a ``nan`` component should have a count of one, while the counts for signed zeros should be aggregated as a single count.
+
+ Parameters
+ ----------
+ x: array
+ input array. If ``x`` has more than one dimension, the function must flatten ``x`` and return the unique elements of the flattened array.
+
+ Returns
+ -------
+ out: Tuple[array, array]
+ a namedtuple `(values, counts)` whose
+
+ - first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
+ - second element must have the field name `counts` and must be an array containing the number of times each unique element occurs in ``x``. The returned array must have same shape as ``values`` and must have the default array index data type.
+
+ .. note::
+ The order of unique elements is not specified and may vary between implementations.
+ """
+
+
+def unique_inverse(x: array, /) -> Tuple[array, array]:
+ """
+ Returns the unique elements of an input array ``x`` and the indices from the set of unique elements that reconstruct ``x``.
+
+ .. admonition:: Data-dependent output shape
+ :class: important
+
+ The shapes of two of the output arrays for this function depend on the data values in the input array; hence, array libraries which build computation graphs (e.g., JAX, Dask, etc.) may find this function difficult to implement without knowing array values. Accordingly, such libraries may choose to omit this function. See :ref:`data-dependent-output-shapes` section for more details.
+
+ .. note::
+ Uniqueness should be determined based on value equality (see :func:`~array_api.equal`). For input arrays having floating-point data types, value-based equality implies the following behavior.
+
+ - As ``nan`` values compare as ``False``, ``nan`` values should be considered distinct.
+ - As complex floating-point values having at least one ``nan`` component compare as ``False``, complex floating-point values having ``nan`` components should be considered distinct.
+ - As ``-0`` and ``+0`` compare as ``True``, signed zeros should not be considered distinct, and the corresponding unique element will be implementation-dependent (e.g., an implementation could choose to return ``-0`` if ``-0`` occurs before ``+0``).
+
+ As signed zeros are not distinct, using ``inverse_indices`` to reconstruct the input array is not guaranteed to return an array having the exact same values.
+
+ Parameters
+ ----------
+ x: array
+ input array. If ``x`` has more than one dimension, the function must flatten ``x`` and return the unique elements of the flattened array.
+
+ Returns
+ -------
+ out: Tuple[array, array]
+ a namedtuple ``(values, inverse_indices)`` whose
+
+ - first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
+ - second element must have the field name ``inverse_indices`` and must be an array containing the indices of ``values`` that reconstruct ``x``. The array must have the same shape as ``x`` and have the default array index data type.
+
+ .. note::
+ The order of unique elements is not specified and may vary between implementations.
+ """
+
+
+def unique_values(x: array, /) -> array:
+ """
+ Returns the unique elements of an input array ``x``.
+
+ .. admonition:: Data-dependent output shape
+ :class: important
+
+ The shapes of two of the output arrays for this function depend on the data values in the input array; hence, array libraries which build computation graphs (e.g., JAX, Dask, etc.) may find this function difficult to implement without knowing array values. Accordingly, such libraries may choose to omit this function. See :ref:`data-dependent-output-shapes` section for more details.
+
+ .. note::
+ Uniqueness should be determined based on value equality (see :func:`~array_api.equal`). For input arrays having floating-point data types, value-based equality implies the following behavior.
+
+ - As ``nan`` values compare as ``False``, ``nan`` values should be considered distinct.
+ - As complex floating-point values having at least one ``nan`` component compare as ``False``, complex floating-point values having ``nan`` components should be considered distinct.
+ - As ``-0`` and ``+0`` compare as ``True``, signed zeros should not be considered distinct, and the corresponding unique element will be implementation-dependent (e.g., an implementation could choose to return ``-0`` if ``-0`` occurs before ``+0``).
+
+ Parameters
+ ----------
+ x: array
+ input array. If ``x`` has more than one dimension, the function must flatten ``x`` and return the unique elements of the flattened array.
+
+ Returns
+ -------
+ out: array
+ an array containing the set of unique elements in ``x``. The returned array must have the same data type as ``x``.
+
+ .. note::
+ The order of unique elements is not specified and may vary between implementations.
+ """
+
+
+__all__ = ["unique_all", "unique_counts", "unique_inverse", "unique_values"]
diff --git a/src/array_api_stubs/_draft/sorting_functions.py b/src/array_api_stubs/_draft/sorting_functions.py
new file mode 100644
index 000000000..3eb52c8ce
--- /dev/null
+++ b/src/array_api_stubs/_draft/sorting_functions.py
@@ -0,0 +1,58 @@
+from ._types import array
+
+
+def argsort(
+ x: array, /, *, axis: int = -1, descending: bool = False, stable: bool = True
+) -> array:
+ """
+ Returns the indices that sort an array ``x`` along a specified axis.
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x : array
+ input array. Should have a real-valued data type.
+ axis: int
+ axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
+ descending: bool
+ sort order. If ``True``, the returned indices sort ``x`` in descending order (by value). If ``False``, the returned indices sort ``x`` in ascending order (by value). Default: ``False``.
+ stable: bool
+ sort stability. If ``True``, the returned indices must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned indices may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
+
+ Returns
+ -------
+ out : array
+ an array of indices. The returned array must have the same shape as ``x``. The returned array must have the default array index data type.
+ """
+
+
+def sort(
+ x: array, /, *, axis: int = -1, descending: bool = False, stable: bool = True
+) -> array:
+ """
+ Returns a sorted copy of an input array ``x``.
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued data type.
+ axis: int
+ axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
+ descending: bool
+ sort order. If ``True``, the array must be sorted in descending order (by value). If ``False``, the array must be sorted in ascending order (by value). Default: ``False``.
+ stable: bool
+ sort stability. If ``True``, the returned array must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned array may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
+
+ Returns
+ -------
+ out : array
+ a sorted array. The returned array must have the same data type and shape as ``x``.
+ """
+
+
+__all__ = ["argsort", "sort"]
diff --git a/src/array_api_stubs/_draft/statistical_functions.py b/src/array_api_stubs/_draft/statistical_functions.py
new file mode 100644
index 000000000..787faeeb9
--- /dev/null
+++ b/src/array_api_stubs/_draft/statistical_functions.py
@@ -0,0 +1,314 @@
+from ._types import Optional, Tuple, Union, array, dtype
+
+
+def max(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the maximum value of the input array ``x``.
+
+ .. note::
+ When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the minimum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``-infinity``).
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which maximum values must be computed. By default, the maximum value must be computed over the entire array. If a tuple of integers, maximum values must be computed over multiple axes. Default: ``None``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the maximum value was computed over the entire array, a zero-dimensional array containing the maximum value; otherwise, a non-zero-dimensional array containing the maximum values. The returned array must have the same data type as ``x``.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ For floating-point operands,
+
+ - If ``x_i`` is ``NaN``, the maximum value is ``NaN`` (i.e., ``NaN`` values propagate).
+ """
+
+
+def mean(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the arithmetic mean of the input array ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued floating-point data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which arithmetic means must be computed. By default, the mean must be computed over the entire array. If a tuple of integers, arithmetic means must be computed over multiple axes. Default: ``None``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the arithmetic mean was computed over the entire array, a zero-dimensional array containing the arithmetic mean; otherwise, a non-zero-dimensional array containing the arithmetic means. The returned array must have the same data type as ``x``.
+
+ .. note::
+ While this specification recommends that this function only accept input arrays having a real-valued floating-point data type, specification-compliant array libraries may choose to accept input arrays having an integer data type. While mixed data type promotion is implementation-defined, if the input array ``x`` has an integer data type, the returned array must have the default real-valued floating-point data type.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ Let ``N`` equal the number of elements over which to compute the arithmetic mean.
+
+ - If ``N`` is ``0``, the arithmetic mean is ``NaN``.
+ - If ``x_i`` is ``NaN``, the arithmetic mean is ``NaN`` (i.e., ``NaN`` values propagate).
+ """
+
+
+def min(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the minimum value of the input array ``x``.
+
+ .. note::
+ When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the maximum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``+infinity``).
+
+ .. note::
+ For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which minimum values must be computed. By default, the minimum value must be computed over the entire array. If a tuple of integers, minimum values must be computed over multiple axes. Default: ``None``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the minimum value was computed over the entire array, a zero-dimensional array containing the minimum value; otherwise, a non-zero-dimensional array containing the minimum values. The returned array must have the same data type as ``x``.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ For floating-point operands,
+
+ - If ``x_i`` is ``NaN``, the minimum value is ``NaN`` (i.e., ``NaN`` values propagate).
+ """
+
+
+def prod(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ dtype: Optional[dtype] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the product of input array ``x`` elements.
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a numeric data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which products must be computed. By default, the product must be computed over the entire array. If a tuple of integers, products must be computed over multiple axes. Default: ``None``.
+ dtype: Optional[dtype]
+ data type of the returned array. If ``None``,
+
+ - if the default data type corresponding to the data type "kind" (integer, real-valued floating-point, or complex floating-point) of ``x`` has a smaller range of values than the data type of ``x`` (e.g., ``x`` has data type ``int64`` and the default data type is ``int32``, or ``x`` has data type ``uint64`` and the default data type is ``int64``), the returned array must have the same data type as ``x``.
+ - if ``x`` has a real-valued floating-point data type, the returned array must have the default real-valued floating-point data type.
+ - if ``x`` has a complex floating-point data type, the returned array must have the default complex floating-point data type.
+ - if ``x`` has a signed integer data type (e.g., ``int16``), the returned array must have the default integer data type.
+ - if ``x`` has an unsigned integer data type (e.g., ``uint16``), the returned array must have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is ``int32``, the returned array must have a ``uint32`` data type).
+
+ If the data type (either specified or resolved) differs from the data type of ``x``, the input array should be cast to the specified data type before computing the product. Default: ``None``.
+
+ .. note::
+ This keyword argument is intended to help prevent data type overflows.
+
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the product was computed over the entire array, a zero-dimensional array containing the product; otherwise, a non-zero-dimensional array containing the products. The returned array must have a data type as described by the ``dtype`` parameter above.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ Let ``N`` equal the number of elements over which to compute the product.
+
+ - If ``N`` is ``0``, the product is `1` (i.e., the empty product).
+
+ For both real-valued and complex floating-point operands, special cases must be handled as if the operation is implemented by successive application of :func:`~array_api.multiply`.
+ """
+
+
+def std(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ correction: Union[int, float] = 0.0,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the standard deviation of the input array ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued floating-point data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which standard deviations must be computed. By default, the standard deviation must be computed over the entire array. If a tuple of integers, standard deviations must be computed over multiple axes. Default: ``None``.
+ correction: Union[int, float]
+ degrees of freedom adjustment. Setting this parameter to a value other than ``0`` has the effect of adjusting the divisor during the calculation of the standard deviation according to ``N-c`` where ``N`` corresponds to the total number of elements over which the standard deviation is computed and ``c`` corresponds to the provided degrees of freedom adjustment. When computing the standard deviation of a population, setting this parameter to ``0`` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample standard deviation, setting this parameter to ``1`` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction). Default: ``0``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the standard deviation was computed over the entire array, a zero-dimensional array containing the standard deviation; otherwise, a non-zero-dimensional array containing the standard deviations. The returned array must have the same data type as ``x``.
+
+ .. note::
+ While this specification recommends that this function only accept input arrays having a real-valued floating-point data type, specification-compliant array libraries may choose to accept input arrays having an integer data type. While mixed data type promotion is implementation-defined, if the input array ``x`` has an integer data type, the returned array must have the default real-valued floating-point data type.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ Let ``N`` equal the number of elements over which to compute the standard deviation.
+
+ - If ``N - correction`` is less than or equal to ``0``, the standard deviation is ``NaN``.
+ - If ``x_i`` is ``NaN``, the standard deviation is ``NaN`` (i.e., ``NaN`` values propagate).
+ """
+
+
+def sum(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ dtype: Optional[dtype] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the sum of the input array ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a numeric data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which sums must be computed. By default, the sum must be computed over the entire array. If a tuple of integers, sums must be computed over multiple axes. Default: ``None``.
+ dtype: Optional[dtype]
+ data type of the returned array. If ``None``,
+
+ - if the default data type corresponding to the data type "kind" (integer, real-valued floating-point, or complex floating-point) of ``x`` has a smaller range of values than the data type of ``x`` (e.g., ``x`` has data type ``int64`` and the default data type is ``int32``, or ``x`` has data type ``uint64`` and the default data type is ``int64``), the returned array must have the same data type as ``x``.
+ - if ``x`` has a real-valued floating-point data type, the returned array must have the default real-valued floating-point data type.
+ - if ``x`` has a complex floating-point data type, the returned array must have the default complex floating-point data type.
+ - if ``x`` has a signed integer data type (e.g., ``int16``), the returned array must have the default integer data type.
+ - if ``x`` has an unsigned integer data type (e.g., ``uint16``), the returned array must have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is ``int32``, the returned array must have a ``uint32`` data type).
+
+ If the data type (either specified or resolved) differs from the data type of ``x``, the input array should be cast to the specified data type before computing the sum. Default: ``None``.
+
+ .. note::
+ keyword argument is intended to help prevent data type overflows.
+
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the sum was computed over the entire array, a zero-dimensional array containing the sum; otherwise, an array containing the sums. The returned array must have a data type as described by the ``dtype`` parameter above.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ Let ``N`` equal the number of elements over which to compute the sum.
+
+ - If ``N`` is ``0``, the sum is ``0`` (i.e., the empty sum).
+
+ For both real-valued and complex floating-point operands, special cases must be handled as if the operation is implemented by successive application of :func:`~array_api.add`.
+ """
+
+
+def var(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ correction: Union[int, float] = 0.0,
+ keepdims: bool = False,
+) -> array:
+ """
+ Calculates the variance of the input array ``x``.
+
+ Parameters
+ ----------
+ x: array
+ input array. Should have a real-valued floating-point data type.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which variances must be computed. By default, the variance must be computed over the entire array. If a tuple of integers, variances must be computed over multiple axes. Default: ``None``.
+ correction: Union[int, float]
+ degrees of freedom adjustment. Setting this parameter to a value other than ``0`` has the effect of adjusting the divisor during the calculation of the variance according to ``N-c`` where ``N`` corresponds to the total number of elements over which the variance is computed and ``c`` corresponds to the provided degrees of freedom adjustment. When computing the variance of a population, setting this parameter to ``0`` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the unbiased sample variance, setting this parameter to ``1`` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction). Default: ``0``.
+ keepdims: bool
+ if ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if the variance was computed over the entire array, a zero-dimensional array containing the variance; otherwise, a non-zero-dimensional array containing the variances. The returned array must have the same data type as ``x``.
+
+
+ .. note::
+ While this specification recommends that this function only accept input arrays having a real-valued floating-point data type, specification-compliant array libraries may choose to accept input arrays having an integer data type. While mixed data type promotion is implementation-defined, if the input array ``x`` has an integer data type, the returned array must have the default real-valued floating-point data type.
+
+ Notes
+ -----
+
+ **Special Cases**
+
+ Let ``N`` equal the number of elements over which to compute the variance.
+
+ - If ``N - correction`` is less than or equal to ``0``, the variance is ``NaN``.
+ - If ``x_i`` is ``NaN``, the variance is ``NaN`` (i.e., ``NaN`` values propagate).
+ """
+
+
+__all__ = ["max", "mean", "min", "prod", "std", "sum", "var"]
diff --git a/src/array_api_stubs/_draft/utility_functions.py b/src/array_api_stubs/_draft/utility_functions.py
new file mode 100644
index 000000000..e70fe8aa6
--- /dev/null
+++ b/src/array_api_stubs/_draft/utility_functions.py
@@ -0,0 +1,74 @@
+from ._types import Optional, Tuple, Union, array
+
+
+def all(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Tests whether all input array elements evaluate to ``True`` along a specified axis.
+
+ .. note::
+ Positive infinity, negative infinity, and NaN must evaluate to ``True``.
+
+ .. note::
+ If ``x`` has a complex floating-point data type, elements having a non-zero component (real or imaginary) must evaluate to ``True``.
+
+ .. note::
+ If ``x`` is an empty array or the size of the axis (dimension) along which to evaluate elements is zero, the test result must be ``True``.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which to perform a logical AND reduction. By default, a logical AND reduction must be performed over the entire array. If a tuple of integers, logical AND reductions must be performed over multiple axes. A valid ``axis`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x``. If an ``axis`` is specified as a negative integer, the function must determine the axis along which to perform a reduction by counting backward from the last dimension (where ``-1`` refers to the last dimension). If provided an invalid ``axis``, the function must raise an exception. Default: ``None``.
+ keepdims: bool
+ If ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if a logical AND reduction was performed over the entire array, the returned array must be a zero-dimensional array containing the test result; otherwise, the returned array must be a non-zero-dimensional array containing the test results. The returned array must have a data type of ``bool``.
+ """
+
+
+def any(
+ x: array,
+ /,
+ *,
+ axis: Optional[Union[int, Tuple[int, ...]]] = None,
+ keepdims: bool = False,
+) -> array:
+ """
+ Tests whether any input array element evaluates to ``True`` along a specified axis.
+
+ .. note::
+ Positive infinity, negative infinity, and NaN must evaluate to ``True``.
+
+ .. note::
+ If ``x`` has a complex floating-point data type, elements having a non-zero component (real or imaginary) must evaluate to ``True``.
+
+ .. note::
+ If ``x`` is an empty array or the size of the axis (dimension) along which to evaluate elements is zero, the test result must be ``False``.
+
+ Parameters
+ ----------
+ x: array
+ input array.
+ axis: Optional[Union[int, Tuple[int, ...]]]
+ axis or axes along which to perform a logical OR reduction. By default, a logical OR reduction must be performed over the entire array. If a tuple of integers, logical OR reductions must be performed over multiple axes. A valid ``axis`` must be an integer on the interval ``[-N, N)``, where ``N`` is the rank (number of dimensions) of ``x``. If an ``axis`` is specified as a negative integer, the function must determine the axis along which to perform a reduction by counting backward from the last dimension (where ``-1`` refers to the last dimension). If provided an invalid ``axis``, the function must raise an exception. Default: ``None``.
+ keepdims: bool
+ If ``True``, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see :ref:`broadcasting`). Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
+
+ Returns
+ -------
+ out: array
+ if a logical OR reduction was performed over the entire array, the returned array must be a zero-dimensional array containing the test result; otherwise, the returned array must be a non-zero-dimensional array containing the test results. The returned array must have a data type of ``bool``.
+ """
+
+
+__all__ = ["all", "any"]
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy