summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_creation_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-01-20 18:25:20 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-01-20 18:25:20 -0700
commit1efd55efa8cac9afd12d299dcf8912a7a7ac8a68 (patch)
treeff6111d9091b0a96cfebc15a3ae5bab5a96e27b4 /numpy/_array_api/_creation_functions.py
parentad19f7f7dfcfe33fd4591f1be3b4d9d30887899a (diff)
downloadnumpy-1efd55efa8cac9afd12d299dcf8912a7a7ac8a68.tar.gz
Use _implementation on all functions that have it in the array API submodule
That way they only work on actual ndarray inputs, not array-like, which is more inline with the spec.
Diffstat (limited to 'numpy/_array_api/_creation_functions.py')
-rw-r--r--numpy/_array_api/_creation_functions.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py
index df64ed1d6..68326f291 100644
--- a/numpy/_array_api/_creation_functions.py
+++ b/numpy/_array_api/_creation_functions.py
@@ -35,7 +35,7 @@ def empty_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[d
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return np.empty_like(x, dtype=dtype)
+ return np.empty_like._implementation(x, dtype=dtype)
def eye(N: int, /, *, M: Optional[int] = None, k: Optional[int] = 0, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
"""
@@ -68,7 +68,7 @@ def full_like(x: array, fill_value: Union[int, float], /, *, dtype: Optional[dty
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return np.full_like(x, fill_value, dtype=dtype)
+ return np.full_like._implementation(x, fill_value, dtype=dtype)
def linspace(start: Union[int, float], stop: Union[int, float], num: int, /, *, dtype: Optional[dtype] = None, device: Optional[device] = None, endpoint: bool = True) -> array:
"""
@@ -101,7 +101,7 @@ def ones_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[de
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return np.ones_like(x, dtype=dtype)
+ return np.ones_like._implementation(x, dtype=dtype)
def zeros(shape: Union[int, Tuple[int, ...]], /, *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
"""
@@ -123,4 +123,4 @@ def zeros_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[d
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
- return np.zeros_like(x, dtype=dtype)
+ return np.zeros_like._implementation(x, dtype=dtype)