Shortcuts

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])

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