torch.Tensor.col_indices¶
- Tensor.col_indices() IntTensor¶
- Returns the tensor containing the column indices of the - selftensor when- selfis a sparse CSR tensor of layout- sparse_csr. The- col_indicestensor is strictly of shape (- self.nnz()) and of type- int32or- int64. When using MKL routines such as sparse matrix multiplication, it is necessary to use- int32indexing in order to avoid downcasting and potentially losing information.- Example::
- >>> csr = torch.eye(5,5).to_sparse_csr() >>> csr.col_indices() tensor([0, 1, 2, 3, 4], dtype=torch.int32)