From 8cdcc1181c2088da4beadef771a7dbc54e89856b Mon Sep 17 00:00:00 2001 From: Ivan Yashchuk Date: Mon, 7 Feb 2022 15:57:37 -0800 Subject: [PATCH] Add missing entry for sampled_addmm in sparse.rst (#72312) Summary: Let's make the documentation for `torch.sparse.sampled_addmm` searchable in the PyTorch documentation. This PR shall be cherry-picked for the next 1.11 release. Pull Request resolved: https://github.com/pytorch/pytorch/pull/72312 Reviewed By: davidberard98 Differential Revision: D34045230 Pulled By: cpuhrsch fbshipit-source-id: c1b1dc907443284857f48c8ce1efab22c6701bbe (cherry picked from commit 225929ecf20eb369f862b091818f5af16ee78f88) --- docs/source/sparse.rst | 1 + torch/sparse/__init__.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docs/source/sparse.rst b/docs/source/sparse.rst index 37c607496a5..178e4cb1860 100644 --- a/docs/source/sparse.rst +++ b/docs/source/sparse.rst @@ -590,6 +590,7 @@ Torch functions specific to sparse Tensors sparse_csr_tensor sparse.sum sparse.addmm + sparse.sampled_addmm sparse.mm sspaddmm hspmm diff --git a/torch/sparse/__init__.py b/torch/sparse/__init__.py index fea6dcfc09c..ba4156019e6 100644 --- a/torch/sparse/__init__.py +++ b/torch/sparse/__init__.py @@ -98,7 +98,9 @@ Performs a matrix multiplication of the dense matrices :attr:`mat1` and :attr:`m specified by the sparsity pattern of :attr:`input`. The matrix :attr:`input` is added to the final result. Mathematically this performs the following operation: + .. math:: + \text{out} = \alpha\ (\text{mat1} \mathbin{@} \text{mat2})*\text{spy}(\text{input}) + \beta\ \text{input} where :math:`\text{spy}(\text{input})` is the sparsity pattern matrix of :attr:`input`, :attr:`alpha`