Skip to content

Commit

Permalink
Added array type check in dpnp.get_usm_ndarray()
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy committed Apr 29, 2023
1 parent 5859aec commit 4d27b4c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,18 @@ def get_usm_ndarray(a):
out : usm_ndarray
A dpctl USM ndarray of input array `a`.
Raises
------
TypeError
If input parameter `a` is of unsupported array type.
"""

return a.get_array() if isinstance(a, dpnp_array) else a
if isinstance(a, dpnp_array):
return a.get_array()
if isinstance(a, dpt.usm_ndarray):
return a
raise TypeError("An array must be any of supported type, but got {}".format(type(a)))


def is_supported_array_type(a):
Expand Down

0 comments on commit 4d27b4c

Please sign in to comment.