eye#
- iskra.sparse.eye(n: int, dtype: dtype = torch.float32, device: str | device = 'cpu') SparseTensor[SOURCE]#
Constructs a sparse COO identity matrix.
- Parameters:
n (int) – Size (number of rows or columns) of the matrix.
dtype (torch.dtype) – Matrix data type. Defaults to
torch.float32.device (str | torch.device, optional) – Device for the matrix. Defaults to “cpu”.
- Returns:
(
SparseTensor[DType, [n, n]]) – Sparsen-by-nidentity matrix in COO format.