Table of Contents
Shortcuts

# 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 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:

    - mat (Tensor) – a dense matrix to be added

    - mat1 (Tensor) – a sparse matrix to be multiplied

    - mat2 (Tensor) – a dense matrix to be multiplied

    - beta (Number, optional) – multiplier for `mat` (β\beta β)

    - alpha (Number, optional) – multiplier for m a t 1@m a t 2 mat1 @ mat2 ma t 1@ma t 2 (α\alpha α)

## 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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.