pytorch / 1 / generated / torch.tensor.to_sparse_bsc.html

torch.Tensor.to_sparse_bsc

Tensor.to_sparse_bsc(blocksize) → Tensor

Convert a CSR tensor to a block sparse column (BSC) storage format of given blocksize.

Example:

>>> dense = torch.randn(10, 10)
>>> sparse = dense.to_sparse_csr()
>>> sparse_bsc = sparse.to_sparse_bsc((5, 5))
>>> sparse_bsc.row_indices()
tensor([0, 1, 0, 1])

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.Tensor.to_sparse_bsc.html