Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-cluster
Commits
713fb60a
Commit
713fb60a
authored
Mar 12, 2020
by
rusty1s
Browse files
small fixes
parent
5a485e98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
csrc/cuda/grid_cuda.cu
csrc/cuda/grid_cuda.cu
+2
-2
torch_cluster/graclus.py
torch_cluster/graclus.py
+8
-2
No files found.
csrc/cuda/grid_cuda.cu
View file @
713fb60a
...
...
@@ -32,9 +32,9 @@ torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size,
cudaSetDevice
(
pos
.
get_device
());
if
(
optional_start
.
has_value
())
CHECK_C
P
U
(
optional_start
.
value
());
CHECK_CU
DA
(
optional_start
.
value
());
if
(
optional_start
.
has_value
())
CHECK_C
P
U
(
optional_start
.
value
());
CHECK_CU
DA
(
optional_start
.
value
());
pos
=
pos
.
view
({
pos
.
size
(
0
),
-
1
}).
contiguous
();
size
=
size
.
contiguous
();
...
...
torch_cluster/graclus.py
View file @
713fb60a
...
...
@@ -36,15 +36,21 @@ def graclus_cluster(row: torch.Tensor, col: torch.Tensor,
mask
=
row
==
col
row
,
col
=
row
[
mask
],
col
[
mask
]
# Randomly shuffle nodes.
if
weight
is
not
None
:
perm
=
torch
.
randperm
(
row
.
size
(
0
),
device
=
row
.
device
)
weight
=
weight
[
mask
]
# Randomly shuffle nodes.
if
weight
is
None
:
perm
=
torch
.
randperm
(
row
.
size
(
0
),
dtype
=
torch
.
long
,
device
=
row
.
device
)
row
,
col
=
row
[
perm
],
col
[
perm
]
# To CSR.
perm
=
torch
.
argsort
(
row
)
row
,
col
=
row
[
perm
],
col
[
perm
]
if
weight
is
not
None
:
weight
=
weight
[
perm
]
deg
=
row
.
new_zeros
(
num_nodes
)
deg
.
scatter_add_
(
0
,
row
,
torch
.
ones_like
(
row
))
rowptr
=
row
.
new_zeros
(
num_nodes
+
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment