-
Notifications
You must be signed in to change notification settings - Fork 29
Unhelpful error message when calling asnumpy
with non-usm_array type
#1457
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
Comments
Reproducer: import dpctl.tensor as dpt
# raises unhelpful TypeError with empty message
dpt.asnumpy([1,2,3]) |
oleksandr-pavlyk
added a commit
that referenced
this issue
Oct 28, 2023
Closes gh-1457 ``` In [1]: import dpctl.tensor as dpt In [2]: dpt.asnumpy([1,2,3]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 dpt.asnumpy([1,2,3]) File ~/repos/dpctl/dpctl/tensor/_copy_utils.py:185, in asnumpy(usm_ary) 169 def asnumpy(usm_ary): 170 """ 171 asnumpy(usm_ary) 172 (...) 183 of `usm_ary` 184 """ --> 185 return _copy_to_numpy(usm_ary) File ~/repos/dpctl/dpctl/tensor/_copy_utils.py:40, in _copy_to_numpy(ary) 38 def _copy_to_numpy(ary): 39 if not isinstance(ary, dpt.usm_ndarray): ---> 40 raise TypeError( 41 f"Expected dpctl.tensor.usm_ndarray, got {type(ary)}" 42 ) 43 nb = ary.usm_data.nbytes 44 hh = dpm.MemoryUSMHost(nb, queue=ary.sycl_queue) TypeError: Expected dpctl.tensor.usm_ndarray, got <class 'list'> In [3]: quit ```
6 tasks
ndgrigorian
pushed a commit
that referenced
this issue
Oct 31, 2023
Closes gh-1457 ``` In [1]: import dpctl.tensor as dpt In [2]: dpt.asnumpy([1,2,3]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 dpt.asnumpy([1,2,3]) File ~/repos/dpctl/dpctl/tensor/_copy_utils.py:185, in asnumpy(usm_ary) 169 def asnumpy(usm_ary): 170 """ 171 asnumpy(usm_ary) 172 (...) 183 of `usm_ary` 184 """ --> 185 return _copy_to_numpy(usm_ary) File ~/repos/dpctl/dpctl/tensor/_copy_utils.py:40, in _copy_to_numpy(ary) 38 def _copy_to_numpy(ary): 39 if not isinstance(ary, dpt.usm_ndarray): ---> 40 raise TypeError( 41 f"Expected dpctl.tensor.usm_ndarray, got {type(ary)}" 42 ) 43 nb = ary.usm_data.nbytes 44 hh = dpm.MemoryUSMHost(nb, queue=ary.sycl_queue) TypeError: Expected dpctl.tensor.usm_ndarray, got <class 'list'> In [3]: quit ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/IntelPython/dpctl/blob/master/dpctl/tensor/_copy_utils.py#L40
The text was updated successfully, but these errors were encountered: