From 012343dec5599418b77512733fc5b8db6bc14c4c Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Mon, 11 Jan 2021 16:03:43 -0700 Subject: 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). --- numpy/_array_api/creation_functions.py | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 numpy/_array_api/creation_functions.py (limited to 'numpy/_array_api/creation_functions.py') 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'] -- cgit v1.2.1