def test_shape(di, dj, dk): x = self._gen_sparse(2, 20, [di, dj])[0] y = self.randn(dj, dk) res = torch.hsmm(x, y) expected = torch.mm(x.to_dense(), y) self.assertEqual(res.to_dense(), expected)
def test_shape(di, dj, dk): x = self._gen_sparse(2, 20, [di, dj])[0] y = self.randn(dj, dk) res = torch.hsmm(x, y) # TODO: use self.safeToDense(), but this triggers # https://github.com/pytorch/pytorch/issues/3170 expected = torch.mm(x.to_dense(), y) self.assertEqual(res.to_dense(), expected)