On this page
torch.Tensor.to_sparse_bsr
Tensor.to_sparse_bsr(blocksize) → Tensor
-
Convert a CSR tensor to a block sparse row (BSR) storage format of given blocksize.
Example:
>>> dense = torch.randn(10, 10) >>> sparse = dense.to_sparse_csr() >>> sparse_bsr = sparse.to_sparse_bsr((5, 5)) >>> sparse_bsr.col_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_bsr.html