Skip to content

Commit 2b5bbe9

Browse files
author
Diptorup Deb
committed
Add repr and str methods to DpnpNdarray and USMNdarray types.
1 parent 0242ed3 commit 2b5bbe9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

numba_dpex/core/types/dpnp_ndarray_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
5858
else:
5959
return
6060

61+
def __str__(self):
62+
return self.name.replace("USMNdArray", "DpnpNdarray")
63+
64+
def __repr__(self):
65+
return self.__str__()
66+
6167
def __allocate__(
6268
self,
6369
typingctx,

numba_dpex/core/types/usm_ndarray_type.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(
8787
self.dtype = dtype
8888

8989
if name is None:
90-
type_name = "usm_ndarray"
90+
type_name = "USMNdArray"
9191
if readonly:
9292
type_name = "readonly " + type_name
9393
if not aligned:
@@ -116,6 +116,9 @@ def __init__(
116116
aligned=aligned,
117117
)
118118

119+
def __repr__(self):
120+
return self.name
121+
119122
def copy(
120123
self,
121124
dtype=None,

0 commit comments

Comments
 (0)