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
vis a 1-D array, then it returns a 2-D array with the specified diagonal filled byv. Ifvis a 2-D array, then it returns the specified diagonal ofv. In latter case, ifvis achainerx.ndarrayobject, then its view is returned.- Return type
Note
The argument
vdoes not support array-like objects yet.See also