summaryrefslogtreecommitdiff
path: root/tools/autograd
diff options
context:
space:
mode:
authorRichard Zou <zou3519@users.noreply.github.com>2018-02-07 15:42:29 -0500
committerSam Gross <colesbury@gmail.com>2018-02-07 15:42:29 -0500
commitbf603299b6a61d05744dbee8a4ee642bbac2979f (patch)
treeab38f950f8855db06654cdaf940fe804b79a4ecf /tools/autograd
parent85e22b54758b28bd69bf638cde917d7443d886bd (diff)
downloadpytorch-bf603299b6a61d05744dbee8a4ee642bbac2979f.tar.gz
pytorch-bf603299b6a61d05744dbee8a4ee642bbac2979f.tar.bz2
pytorch-bf603299b6a61d05744dbee8a4ee642bbac2979f.zip
Restore torch.mm behavior for sparse variables (#5077)
torch.mm(sparse, dense) -> dense works for tensors. This PR makes it work for variables as well. I renamed mm to _mm in Declarations.cwrap and wrote a native mm function that wraps _mm for the dense case and addmm for the sparse case.
Diffstat (limited to 'tools/autograd')
-rw-r--r--tools/autograd/derivatives.yaml2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/autograd/derivatives.yaml b/tools/autograd/derivatives.yaml
index 33077041da..1617febe9d 100644
--- a/tools/autograd/derivatives.yaml
+++ b/tools/autograd/derivatives.yaml
@@ -407,7 +407,7 @@
self: grad.clone().masked_fill_(self >= other, 0)
other: grad.clone().masked_fill_(self < other, 0)
-- name: mm(Tensor self, Tensor mat2)
+- name: _mm(Tensor self, Tensor mat2)
self: mm_mat1_backward(grad, mat2, self.sizes(), self.strides(), 1)
mat2: mm_mat2_backward(grad, self, mat2.sizes(), mat2.strides(), 1)