Skip to content

Commit

Permalink
fix coalesce on CUDA
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Oct 26, 2021
1 parent 2910199 commit 101ed2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion torch_geometric/utils/coalesce.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def coalesce(
return edge_index

dim_size = edge_index.size(1)
idx = torch.arange(0, nnz).sub_(mask.logical_not_().cumsum(dim=0))
idx = torch.arange(0, nnz, device=edge_index.device)
idx.sub_(mask.logical_not_().cumsum(dim=0))

if isinstance(edge_attr, Tensor):
edge_attr = scatter(edge_attr, idx, 0, None, dim_size, reduce)
Expand Down

0 comments on commit 101ed2c

Please sign in to comment.