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-sparse
Commits
45a4d985
Commit
45a4d985
authored
Jun 22, 2020
by
james77777778
Browse files
fix the bug from metis if num_parts == 1
parent
6884191b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
test/test_metis.py
test/test_metis.py
+5
-0
torch_sparse/metis.py
torch_sparse/metis.py
+7
-2
No files found.
test/test_metis.py
View file @
45a4d985
...
...
@@ -30,3 +30,8 @@ def test_metis(device):
weighted
=
False
)
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
_
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
1
,
recursive
=
False
,
weighted
=
True
)
assert
partptr
.
numel
()
==
2
assert
perm
.
numel
()
==
6
torch_sparse/metis.py
View file @
45a4d985
...
...
@@ -33,8 +33,13 @@ def partition(src: SparseTensor, num_parts: int, recursive: bool = False,
else
:
value
=
None
cluster
=
torch
.
ops
.
torch_sparse
.
partition
(
rowptr
,
col
,
value
,
num_parts
,
recursive
)
if
num_parts
>
1
:
cluster
=
torch
.
ops
.
torch_sparse
.
partition
(
rowptr
,
col
,
value
,
num_parts
,
recursive
)
elif
num_parts
==
1
:
cluster
=
torch
.
zeros
((
src
.
size
(
0
)),
dtype
=
torch
.
long
)
else
:
raise
ValueError
cluster
=
cluster
.
to
(
src
.
device
())
cluster
,
perm
=
cluster
.
sort
()
...
...
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