Skip to content

Commit ae0d097

Browse files
authored
Merge branch 'master' into multiply_by_scalar
2 parents ec1fb4f + 2b8788d commit ae0d097

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

dpnp/dpnp_array.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,22 @@ def __setitem__(self, key, val):
278278
# '__setstate__',
279279
# '__sizeof__',
280280

281+
281282
def __str__(self):
282-
""" Output values from the array to standard output
283+
"""
284+
Output values from the array to standard output.
283285
284-
Example:
285-
[[ 136. 136. 136.]
286-
[ 272. 272. 272.]
287-
[ 408. 408. 408.]]
286+
Examples
287+
--------
288+
>>> print(a)
289+
[[ 136. 136. 136.]
290+
[ 272. 272. 272.]
291+
[ 408. 408. 408.]]
288292
289293
"""
290294

291-
return str(dpnp.asnumpy(self._array_obj))
295+
return str(self.asnumpy())
296+
292297

293298
def __sub__(self, other):
294299
return dpnp.subtract(self, other)
@@ -425,6 +430,20 @@ def argsort(self, axis=-1, kind=None, order=None):
425430
"""
426431
return dpnp.argsort(self, axis, kind, order)
427432

433+
434+
def asnumpy(self):
435+
"""
436+
Copy content of the array into :class:`numpy.ndarray` instance of the same shape and data type.
437+
438+
Returns
439+
-------
440+
An instance of :class:`numpy.ndarray` populated with the array content.
441+
442+
"""
443+
444+
return dpt.asnumpy(self._array_obj)
445+
446+
428447
def astype(self, dtype, order='K', casting='unsafe', subok=True, copy=True):
429448
"""Copy the array with data type casting.
430449

dpnp/dpnp_iface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def asnumpy(input, order='C'):
143143
144144
"""
145145
if isinstance(input, dpnp_array):
146-
return dpt.asnumpy(input.get_array())
146+
return input.asnumpy()
147147

148148
if isinstance(input, dpt.usm_ndarray):
149149
return dpt.asnumpy(input)

0 commit comments

Comments
 (0)