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