Skip to contents

Creates an n x n identity matrix.

Usage

nv_eye(n, dtype = "f32")

Arguments

n

(integer(1))
Size of the identity matrix.

dtype

(character(1) | stablehlo::TensorDataType)
Data type.

Value

tensorish
An n x n identity matrix.

See also

nv_diag() for general diagonal matrices.

Examples

jit_eval(nv_eye(3L))
#> AnvilTensor
#>  1 0 0
#>  0 1 0
#>  0 0 1
#> [ CPUf32{3,3} ]