torch.sparse.addmm#
- torch.sparse.addmm(mat, mat1, mat2, *, beta=1., alpha=1.) Tensor#
This function does exact same thing as
torch.addmm()in the forward, except that it supports backward for sparse COO and CSR matrixmat1. Whenmat1is a COO tensor it must have sparse_dim = 2.Supports both CSR and COO storage formats.
Note
Gradient support:
COO @ Dense: Backward is supported for both inputs. The gradient for the sparse input is returned as a sparse COO tensor.
CSR @ Dense: Backward is supported for both inputs. The gradient for the sparse input is returned as a sparse CSR tensor.
CSC/BSR/BSC @ Dense: Not supported.
Sparse @ Sparse (COO @ COO, CSR @ CSR): Forward works, but backward is not supported.