dpnp.tensor.eye¶
- dpnp.tensor.eye(n_rows, n_cols=None, /, *, k=0, dtype=None, order='C', device=None, usm_type='device', sycl_queue=None)[source]¶
Creates
dpnp.tensor.usm_ndarraywith ones on the k-th diagonal.- Parameters:
n_rows (int) -- number of rows in the output array.
n_cols ({None, int}, optional) --
number of columns in the output array. If
None,n_cols = n_rows.Default:
None.k (int, optional) --
index of the diagonal, with
0as the main diagonal. A positive value ofkis a superdiagonal, a negative value is a subdiagonal. RaisesTypeErrorifkis not an integer.Default:
0.dtype ({None, dtype}, optional) --
data type of the array. Can be typestring, a
numpy.dtypeobject,numpychar string, or a NumPy scalar type.Default:
None.order ({"C", "F"}, optional) --
memory layout for the array.
Default:
"C".device ({None, object}, optional) --
array API concept of device where the output array is created.
devicecan beNone, a oneAPI filter selector string, an instance ofdpctl.SyclDevicecorresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue, or adpnp.tensor.Deviceobject returned bydpnp.tensor.usm_ndarray.device.Default:
None.usm_type ({None, "device", "shared", "host"}, optional) --
The type of SYCL USM allocation for the output array.
Default:
"device".sycl_queue ({None, dpctl.SyclQueue}, optional) --
The SYCL queue to use for output array allocation and copying.
sycl_queueanddeviceare complementary arguments, i.e. use one or another. If both are specified, aTypeErroris raised unless both imply the same underlying SYCL queue to be used. If both areNone, a cached queue targeting default-selected device is used for allocation and population.Default:
None.
- Returns:
out -- A diagonal matrix.
- Return type: