Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of fallback on numpy in dpnp.asfarray #1542

Merged
merged 9 commits into from
Sep 6, 2023
15 changes: 5 additions & 10 deletions dpnp/dpnp_iface_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,13 @@ def asfarray(a, dtype=None):

npolina4 marked this conversation as resolved.
Show resolved Hide resolved
"""
npolina4 marked this conversation as resolved.
Show resolved Hide resolved
npolina4 marked this conversation as resolved.
Show resolved Hide resolved

a_desc = dpnp.get_dpnp_descriptor(a, copy_when_nondefault_queue=False)
if a_desc:
if dtype is None or not numpy.issubdtype(dtype, dpnp.inexact):
if dtype is None or not numpy.issubdtype(dtype, dpnp.inexact):
if dpnp.is_supported_array_type(a):
dtype = dpnp.default_float_type(sycl_queue=a.sycl_queue)
else:
dtype = dpnp.default_float_type()

# if type is the same then same object should be returned
if a_desc.dtype == dtype:
return a

return array(a, dtype=dtype)

return call_origin(numpy.asfarray, a, dtype)
return array(a, dtype=dtype)
npolina4 marked this conversation as resolved.
Show resolved Hide resolved


def atleast_1d(*arys):
Expand Down