summaryrefslogtreecommitdiff
path: root/numpy/_array_api/creation_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-01-11 16:03:43 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-01-11 16:03:43 -0700
commit012343dec5599418b77512733fc5b8db6bc14c4c (patch)
tree13ef3a6bfdcd603036baaf8d65d1647eea749afc /numpy/_array_api/creation_functions.py
parent33dc7bea24f1ab6c47047b49521e732caeb485d5 (diff)
downloadnumpy-012343dec5599418b77512733fc5b8db6bc14c4c.tar.gz
Add initial array_api sub-namespace
This is based on the function stubs from the array API test suite, and is currently based on the assumption that NumPy already follows the array API standard. Now it needs to be modified to fix it in the places where NumPy deviates (for example, different function names for inverse trigonometric functions).
Diffstat (limited to 'numpy/_array_api/creation_functions.py')
-rw-r--r--numpy/_array_api/creation_functions.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/numpy/_array_api/creation_functions.py b/numpy/_array_api/creation_functions.py
new file mode 100644
index 000000000..50b0bd252
--- /dev/null
+++ b/numpy/_array_api/creation_functions.py
@@ -0,0 +1,45 @@
+def arange(start, /, *, stop=None, step=1, dtype=None):
+ from .. import arange
+ return arange(start, stop=stop, step=step, dtype=dtype)
+
+def empty(shape, /, *, dtype=None):
+ from .. import empty
+ return empty(shape, dtype=dtype)
+
+def empty_like(x, /, *, dtype=None):
+ from .. import empty_like
+ return empty_like(x, dtype=dtype)
+
+def eye(N, /, *, M=None, k=0, dtype=None):
+ from .. import eye
+ return eye(N, M=M, k=k, dtype=dtype)
+
+def full(shape, fill_value, /, *, dtype=None):
+ from .. import full
+ return full(shape, fill_value, dtype=dtype)
+
+def full_like(x, fill_value, /, *, dtype=None):
+ from .. import full_like
+ return full_like(x, fill_value, dtype=dtype)
+
+def linspace(start, stop, num, /, *, dtype=None, endpoint=True):
+ from .. import linspace
+ return linspace(start, stop, num, dtype=dtype, endpoint=endpoint)
+
+def ones(shape, /, *, dtype=None):
+ from .. import ones
+ return ones(shape, dtype=dtype)
+
+def ones_like(x, /, *, dtype=None):
+ from .. import ones_like
+ return ones_like(x, dtype=dtype)
+
+def zeros(shape, /, *, dtype=None):
+ from .. import zeros
+ return zeros(shape, dtype=dtype)
+
+def zeros_like(x, /, *, dtype=None):
+ from .. import zeros_like
+ return zeros_like(x, dtype=dtype)
+
+__all__ = ['arange', 'empty', 'empty_like', 'eye', 'full', 'full_like', 'linspace', 'ones', 'ones_like', 'zeros', 'zeros_like']