Table of Contents
Shortcuts

# torch.Tensor.col_indices

Tensor.col_indices() → IntTensor

  Returns the tensor containing the column indices of the `self` tensor when `self` is a sparse CSR tensor of layout `sparse_csr`. The `col_indices` tensor is strictly of shape (`self`.nnz()) and of type `int32` or `int64`. When using MKL routines such as sparse matrix multiplication, it is necessary to use `int32` indexing 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)

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.