summaryrefslogtreecommitdiff
path: root/numpy/array_api/_utility_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-08-04 16:47:05 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-08-04 16:50:30 -0600
commit6e57d829cb6628610e163524f203245b247a2839 (patch)
treef15f4900f995835bbd8526d7a4918a4d776d63e2 /numpy/array_api/_utility_functions.py
parent1596415c32f6008fcacc14a3a5394787aeb44265 (diff)
downloadnumpy-6e57d829cb6628610e163524f203245b247a2839.tar.gz
Rename numpy._array_api to numpy.array_api
Instead of the leading underscore, the experimentalness of the module will be indicated by omitting a warning on import. That we, we do not have to change the API from underscore to no underscore when the module is no longer experimental.
Diffstat (limited to 'numpy/array_api/_utility_functions.py')
-rw-r--r--numpy/array_api/_utility_functions.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/numpy/array_api/_utility_functions.py b/numpy/array_api/_utility_functions.py
new file mode 100644
index 000000000..f243bfe68
--- /dev/null
+++ b/numpy/array_api/_utility_functions.py
@@ -0,0 +1,23 @@
+from __future__ import annotations
+
+from ._array_object import Array
+
+from typing import Optional, Tuple, Union
+
+import numpy as np
+
+def all(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
+ """
+ Array API compatible wrapper for :py:func:`np.all <numpy.all>`.
+
+ See its docstring for more information.
+ """
+ return Array._new(np.asarray(np.all(x._array, axis=axis, keepdims=keepdims)))
+
+def any(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
+ """
+ Array API compatible wrapper for :py:func:`np.any <numpy.any>`.
+
+ See its docstring for more information.
+ """
+ return Array._new(np.asarray(np.any(x._array, axis=axis, keepdims=keepdims)))