Skip to content

Commit d9fb840

Browse files
Update diagonal docstrings (#1837)
1 parent d7400a2 commit d9fb840

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dpnp/dpnp_iface_indexing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ def diagonal(a, offset=0, axis1=0, axis2=1):
279279
"""
280280
Return specified diagonals.
281281
282+
This function always returns a read/write view, and writing to
283+
the returned array will alter your original array.
284+
285+
If you need to modify the array returned by this function without affecting
286+
the original array, we suggest copying the returned array explicitly, i.e.,
287+
use ``dpnp.diagonal(a).copy()`` instead of ``dpnp.diagonal(a)``.
288+
282289
For full documentation refer to :obj:`numpy.diagonal`.
283290
284291
Parameters
@@ -298,6 +305,7 @@ def diagonal(a, offset=0, axis1=0, axis2=1):
298305
Returns
299306
-------
300307
array_of_diagonals : dpnp.ndarray
308+
Array is a read/write view.
301309
If `a` is 2-D, then a 1-D array containing the diagonal and of the
302310
same type as `a` is returned.
303311
If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2`

0 commit comments

Comments
 (0)