summaryrefslogtreecommitdiff
path: root/numpy/array_api/_creation_functions.py
diff options
context:
space:
mode:
authorczgdp1807 <gdp.1807@gmail.com>2021-09-04 22:33:52 +0530
committerczgdp1807 <gdp.1807@gmail.com>2021-09-04 22:33:52 +0530
commit56647dd47345a7fd24b4ee8d9d52025fcdc3b9ae (patch)
tree634ebc0047db0b6590c52826a2c4e62466a421b5 /numpy/array_api/_creation_functions.py
parentc2acd5b25a04783fbbe3ba32426039e4dbe9207e (diff)
downloadnumpy-56647dd47345a7fd24b4ee8d9d52025fcdc3b9ae.tar.gz
Addressed reviews
Diffstat (limited to 'numpy/array_api/_creation_functions.py')
-rw-r--r--numpy/array_api/_creation_functions.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/array_api/_creation_functions.py b/numpy/array_api/_creation_functions.py
index c15d54db1..2d6cf4414 100644
--- a/numpy/array_api/_creation_functions.py
+++ b/numpy/array_api/_creation_functions.py
@@ -43,7 +43,7 @@ def asarray(
*,
dtype: Optional[Dtype] = None,
device: Optional[Device] = None,
- copy: Optional[Union[bool | np._CopyMode]] = None,
+ copy: Optional[Union[bool, np._CopyMode]] = None,
) -> Array:
"""
Array API compatible wrapper for :py:func:`np.asarray <numpy.asarray>`.
@@ -57,11 +57,11 @@ def asarray(
_check_valid_dtype(dtype)
if device not in ["cpu", None]:
raise ValueError(f"Unsupported device {device!r}")
- if copy is False:
+ if copy in (False, np._CopyMode.IF_NEEDED):
# Note: copy=False is not yet implemented in np.asarray
raise NotImplementedError("copy=False is not yet implemented")
if isinstance(obj, Array) and (dtype is None or obj.dtype == dtype):
- if copy is True:
+ if copy in (True, np._CopyMode.ALWAYS):
return Array._new(np.array(obj._array, copy=True, dtype=dtype))
return obj
if dtype is None and isinstance(obj, int) and (obj > 2 ** 64 or obj < -(2 ** 63)):