dgl.sparse.spmmο
- dgl.sparse.spmm(A: SparseMatrix, X: Tensor) Tensor [source]ο
Multiplies a sparse matrix by a dense matrix, equivalent to
A @ X
.- Parameters:
A (SparseMatrix) β Sparse matrix of shape
(L, M)
with scalar valuesX (torch.Tensor) β Dense matrix of shape
(M, N)
or(M)
- Returns:
The dense matrix of shape
(L, N)
or(L)
- Return type:
torch.Tensor
Examples
>>> indices = torch.tensor([[0, 1, 1], [1, 0, 1]]) >>> val = torch.randn(indices.shape[1]) >>> A = dglsp.spmatrix(indices, val) >>> X = torch.randn(2, 3) >>> result = dglsp.spmm(A, X) >>> type(result) <class 'torch.Tensor'> >>> result.shape torch.Size([2, 3])