Skip to content

Commit 1de0bc2

Browse files
Changed behavior of __array_namespace__
usm_ndarray constructor's array_namespace argument's default value of None is now interpreted to mean that usm_ndarray.__array_namespace__ returns dpctl.tensor, rather than None. This directly affects how Python operator special methods of usm_ndarray behave. They would now look up corresponding attribute in dpctl.tensor namespace.
1 parent 438ded5 commit 1de0bc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dpctl/tensor/_usmarray.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ cdef class usm_ndarray:
884884
Returns array namespace, member functions of which
885885
implement data API.
886886
"""
887-
return self.array_namespace_
887+
return self.array_namespace_ if self.array_namespace_ is not None else dpctl.tensor
888888

889889
def __bool__(self):
890890
if self.size == 1:

0 commit comments

Comments
 (0)