summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_creation_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-01-12 16:21:46 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-01-12 16:21:46 -0700
commit4bd5d158e66e6b1ca5f1a767738f0674f0dc8095 (patch)
treed4f20ac37d2ae241e14589150d4fe75620a141e7 /numpy/_array_api/_creation_functions.py
parentba4e21ca150a2d8b3cc08a3e8c981f7042aacf6f (diff)
downloadnumpy-4bd5d158e66e6b1ca5f1a767738f0674f0dc8095.tar.gz
Use "import numpy as np" in the array_api submodule
This avoids importing everything inside the individual functions, but still is preferred over importing the functions used explicitly, as most of them clash with the wrapper function names.
Diffstat (limited to 'numpy/_array_api/_creation_functions.py')
-rw-r--r--numpy/_array_api/_creation_functions.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py
index 4e91aa443..b74eca060 100644
--- a/numpy/_array_api/_creation_functions.py
+++ b/numpy/_array_api/_creation_functions.py
@@ -1,76 +1,67 @@
+import numpy as np
+
def arange(start, /, *, stop=None, step=1, dtype=None, device=None):
- from .. import arange
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return arange(start, stop=stop, step=step, dtype=dtype)
+ return np.arange(start, stop=stop, step=step, dtype=dtype)
def empty(shape, /, *, dtype=None, device=None):
- from .. import empty
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return empty(shape, dtype=dtype)
+ return np.empty(shape, dtype=dtype)
def empty_like(x, /, *, dtype=None, device=None):
- from .. import empty_like
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return empty_like(x, dtype=dtype)
+ return np.empty_like(x, dtype=dtype)
def eye(N, /, *, M=None, k=0, dtype=None, device=None):
- from .. import eye
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return eye(N, M=M, k=k, dtype=dtype)
+ return np.eye(N, M=M, k=k, dtype=dtype)
def full(shape, fill_value, /, *, dtype=None, device=None):
- from .. import full
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return full(shape, fill_value, dtype=dtype)
+ return np.full(shape, fill_value, dtype=dtype)
def full_like(x, fill_value, /, *, dtype=None, device=None):
- from .. import full_like
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return full_like(x, fill_value, dtype=dtype)
+ return np.full_like(x, fill_value, dtype=dtype)
def linspace(start, stop, num, /, *, dtype=None, device=None, endpoint=True):
- from .. import linspace
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return linspace(start, stop, num, dtype=dtype, endpoint=endpoint)
+ return np.linspace(start, stop, num, dtype=dtype, endpoint=endpoint)
def ones(shape, /, *, dtype=None, device=None):
- from .. import ones
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return ones(shape, dtype=dtype)
+ return np.ones(shape, dtype=dtype)
def ones_like(x, /, *, dtype=None, device=None):
- from .. import ones_like
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return ones_like(x, dtype=dtype)
+ return np.ones_like(x, dtype=dtype)
def zeros(shape, /, *, dtype=None, device=None):
- from .. import zeros
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return zeros(shape, dtype=dtype)
+ return np.zeros(shape, dtype=dtype)
def zeros_like(x, /, *, dtype=None, device=None):
- from .. import zeros_like
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return zeros_like(x, dtype=dtype)
+ return np.zeros_like(x, dtype=dtype)