Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sparse]Fix device check #6409

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dgl_sparse/src/sddmm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ void _SDDMMSanityCheck(
mat1.dtype() == mat2.dtype(),
"SDDMM: the two dense matrices should have the same dtype.");
TORCH_CHECK(
mat1.device() == mat2.device(),
"SDDMM: the two dense matrices should on the same device.");
mat1.device() == mat2.device() && sparse_mat->device() == mat2.device(),
"SDDMM: the two dense matrices and sparse matrix should on the same "
"device.");
}

torch::Tensor SDDMMAutoGrad::forward(
Expand Down
1 change: 0 additions & 1 deletion python/dgl/sparse/matmul.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def spspmm(A: SparseMatrix, B: SparseMatrix) -> SparseMatrix:
assert isinstance(
B, SparseMatrix
), f"Expect A2 to be a SparseMatrix object, got {type(B)}."

xiangyuzhi marked this conversation as resolved.
Show resolved Hide resolved
return SparseMatrix(
torch.ops.dgl_sparse.spspmm(A.c_sparse_matrix, B.c_sparse_matrix)
)
Expand Down