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

dpnp.array doesn't return dpnp.ndarray #1570

Closed
samir-nasibli opened this issue Sep 25, 2023 · 1 comment
Closed

dpnp.array doesn't return dpnp.ndarray #1570

samir-nasibli opened this issue Sep 25, 2023 · 1 comment

Comments

@samir-nasibli
Copy link
Contributor

Description

dpnp.array returns the same object, it is expected that it will return wrapped dpnp.ndarray with the same sycl_usm_arrray_interface.

>>> import dpctl
>>> import dpctl.tensor as dpt
>>> import dpnp
>>> dpctl_arr = dpctl.tensor.zeros(12, usm_type="device", sycl_queue=dpctl.SyclQueue("gpu"))
>>> dpctl_arr
usm_ndarray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> result = dpnp.array(dpctl_arr, copy=False)
>>> result
usm_ndarray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> type(result)
<class 'dpctl.tensor._usmarray.usm_ndarray'>

Env

Python 3.10.13

conda list | grep dp
dpctl                     0.15.0rc2
dpnp                      0.13.0rc2
mkl-dpcpp                 2024.0.0
vlad-perevezentsev added a commit that referenced this issue Sep 26, 2023
vlad-perevezentsev added a commit that referenced this issue Sep 26, 2023
* Correct return of object type at zero copy in dpnp.asarray()

* Add tests for gh-1570
@vlad-perevezentsev
Copy link
Collaborator

This issue was solved by #1571
It was due to #1526 which added a new condition in def asarray to return the input argument if dpctl returns zero copying but did not check the case when the input array is usm_ndarray.
Thanks for creating the issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants