diff options
Diffstat (limited to 'numpy/core/_asarray.py')
-rw-r--r-- | numpy/core/_asarray.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/numpy/core/_asarray.py b/numpy/core/_asarray.py index a406308f3..ade53eeaf 100644 --- a/numpy/core/_asarray.py +++ b/numpy/core/_asarray.py @@ -5,6 +5,7 @@ Functions in the ``as*array`` family that promote array-likes into arrays. """ from .overrides import ( array_function_dispatch, + array_function_dispatch_like, set_array_function_like_doc, set_module, ) @@ -97,7 +98,9 @@ def asarray(a, dtype=None, order=None, *, like=None): """ if like is not None: - return _asarray_with_like(a, dtype=dtype, order=order, like=like) + return array_function_dispatch_like( + _asarray_with_like, a, dtype=dtype, order=order, like=like + ) return array(a, dtype, copy=False, order=order) @@ -166,7 +169,9 @@ def asanyarray(a, dtype=None, order=None, *, like=None): """ if like is not None: - return _asanyarray_with_like(a, dtype=dtype, order=order, like=like) + return array_function_dispatch_like( + _asanyarray_with_like, a, dtype=dtype, order=order, like=like + ) return array(a, dtype, copy=False, order=order, subok=True) @@ -223,7 +228,9 @@ def ascontiguousarray(a, dtype=None, *, like=None): """ if like is not None: - return _ascontiguousarray_with_like(a, dtype=dtype, like=like) + return array_function_dispatch_like( + _ascontiguousarray_with_like, a, dtype=dtype, like=like + ) return array(a, dtype, copy=False, order='C', ndmin=1) @@ -276,7 +283,9 @@ def asfortranarray(a, dtype=None, *, like=None): """ if like is not None: - return _asfortranarray_with_like(a, dtype=dtype, like=like) + return array_function_dispatch_like( + _asfortranarray_with_like, a, dtype=dtype, like=like + ) return array(a, dtype, copy=False, order='F', ndmin=1) @@ -363,7 +372,8 @@ def require(a, dtype=None, requirements=None, *, like=None): """ if like is not None: - return _require_with_like( + return array_function_dispatch_like( + _require_with_like, a, dtype=dtype, requirements=requirements, |