torch.sparse.addmm — PyTorch 2.7 documentation (original) (raw)
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 matrix mat1
. When mat1
is a COO tensor it must have sparse_dim = 2. When inputs are COO tensors, this function also supports backward for both inputs.
Supports both CSR and COO storage formats.
Note
This function doesn’t support computing derivaties with respect to CSR matrices.
Parameters