From bf603299b6a61d05744dbee8a4ee642bbac2979f Mon Sep 17 00:00:00 2001 From: Richard Zou Date: Wed, 7 Feb 2018 15:42:29 -0500 Subject: 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. --- tools/autograd/derivatives.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/autograd') 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) -- cgit v1.2.3