cupy.diagonal#
- cupy.diagonal(a, offset=0, axis1=0, axis2=1)[source]#
Returns specified diagonals.
This function extracts the diagonals along two specified axes. The other axes are not changed. This function returns a writable view of this array as NumPy 1.10 will do.
- Parameters:
a (cupy.ndarray) – Array from which the diagonals are taken.
offset (int) – Index of the diagonals. Zero indicates the main diagonals, a positive value upper diagonals, and a negative value lower diagonals.
axis1 (int) – The first axis to take diagonals from.
axis2 (int) – The second axis to take diagonals from.
- Returns:
A view of the diagonals of
a
.- Return type:
See also