chainerx.diag¶
-
chainerx.
diag
(v, k=0, device=None)¶ Returns a diagonal or a diagonal array.
- Parameters
v (ndarray) – Array object.
k (int) – Index of diagonals. Zero indicates the main diagonal, a positive value an upper diagonal, and a negative value a lower diagonal.
device (Device) – Device on which the array is allocated. If omitted, the default device is chosen.
- Returns
If
v
is a 1-D array, then it returns a 2-D array with the specified diagonal filled byv
. Ifv
is a 2-D array, then it returns the specified diagonal ofv
. In latter case, ifv
is achainerx.ndarray
object, then its view is returned.- Return type
Note
The argument
v
does not support array-like objects yet.See also