Creates an n x n identity matrix.
nv_eye_like() is a variant where dtype and device default to those of
like.
Arguments
- n
(
integer(1))
Size of the identity matrix.- dtype
(
character(1)|DataType)
Data type.- device
(
NULL|character(1)| device)
The device the data lives on, given either as:a device string naming the platform (e.g.
"cpu","cuda","cuda:<n>"), which is resolved against the backend in use, ora device object as returned by
nv_device(): aPJRTDevicefor the"pjrt"backend or aquickr_devicefor the"quickr"backend. Because a device object is backend-specific, it also determines the backend.
The default (
NULL) usesdefault_device(): the CPU, or the platform named by thePJRT_PLATFORMenvironment variable on the"pjrt"backend.- like
(
arrayish)
Existing array whose attributes are used as defaults (only fornv_eye_like()).
Value
arrayish
An n x n identity matrix.
See also
nv_diag() for general diagonal matrices.