diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-07-16 15:02:44 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-07-16 15:02:44 -0600 |
commit | 56345ffb82af39149f7cdf8720089e0ba42e798c (patch) | |
tree | bfde4b6458d730997c614bc07ccec67fc11c7697 /numpy/_array_api/_array_object.py | |
parent | d9b958259bda8db50949922770101217b2d0b50a (diff) | |
download | numpy-56345ffb82af39149f7cdf8720089e0ba42e798c.tar.gz |
Use asarray to convert a scalar into an array in the array API Array constructor
Diffstat (limited to 'numpy/_array_api/_array_object.py')
-rw-r--r-- | numpy/_array_api/_array_object.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py index 267bd698f..455e4fb63 100644 --- a/numpy/_array_api/_array_object.py +++ b/numpy/_array_api/_array_object.py @@ -58,9 +58,7 @@ class Array: # Note: The spec does not have array scalars, only 0-D arrays. if isinstance(x, np.generic): # Convert the array scalar to a 0-D array - xa = np.empty((), x.dtype) - xa[()] = x - x = xa + x = np.asarray(x) if x.dtype not in _all_dtypes: raise TypeError(f"The array_api namespace does not support the dtype '{x.dtype}'") obj._array = x |