Skip to content

Commit 4cf9196

Browse files
committed
Implement ndarray.__array__ interface method
1 parent ce3ef5e commit 4cf9196

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dpnp/dpnp_array.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ def __and__(self, other):
192192
"""Return ``self&value``."""
193193
return dpnp.bitwise_and(self, other)
194194

195-
# '__array__',
195+
def __array__(self, dtype=None, /, *, copy=None):
196+
raise TypeError(
197+
"Implicit conversion to a NumPy array is not allowed. "
198+
"Please use `.asnumpy()` to construct a NumPy array explicitly."
199+
)
200+
196201
# '__array_finalize__',
197202
# '__array_function__',
198203
# '__array_interface__',

0 commit comments

Comments
 (0)