Skip to content

Commit 4d27b4c

Browse files
committed
Added array type check in dpnp.get_usm_ndarray()
1 parent 5859aec commit 4d27b4c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dpnp/dpnp_iface.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,18 @@ def get_usm_ndarray(a):
390390
out : usm_ndarray
391391
A dpctl USM ndarray of input array `a`.
392392
393+
Raises
394+
------
395+
TypeError
396+
If input parameter `a` is of unsupported array type.
397+
393398
"""
394399

395-
return a.get_array() if isinstance(a, dpnp_array) else a
400+
if isinstance(a, dpnp_array):
401+
return a.get_array()
402+
if isinstance(a, dpt.usm_ndarray):
403+
return a
404+
raise TypeError("An array must be any of supported type, but got {}".format(type(a)))
396405

397406

398407
def is_supported_array_type(a):

0 commit comments

Comments
 (0)