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
f8697f48
Commit
f8697f48
authored
Feb 23, 2020
by
rusty1s
Browse files
fix test
parent
a06899bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
test/test_metis.py
test/test_metis.py
+5
-1
torch_sparse/metis.py
torch_sparse/metis.py
+2
-1
No files found.
test/test_metis.py
View file @
f8697f48
...
@@ -8,6 +8,10 @@ from .utils import devices
...
@@ -8,6 +8,10 @@ from .utils import devices
@
pytest
.
mark
.
parametrize
(
'device'
,
devices
)
@
pytest
.
mark
.
parametrize
(
'device'
,
devices
)
def
test_metis
(
device
):
def
test_metis
(
device
):
mat
=
SparseTensor
.
from_dense
(
torch
.
randn
((
6
,
6
),
device
=
device
))
mat
=
SparseTensor
.
from_dense
(
torch
.
randn
((
6
,
6
),
device
=
device
))
mat
,
partptr
,
perm
=
mat
.
partition_kway
(
num_parts
=
2
)
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
False
)
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
assert
partptr
.
numel
()
==
3
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
assert
perm
.
numel
()
==
6
torch_sparse/metis.py
View file @
f8697f48
...
@@ -21,4 +21,5 @@ def partition(
...
@@ -21,4 +21,5 @@ def partition(
return
out
,
partptr
,
perm
return
out
,
partptr
,
perm
SparseTensor
.
partition
=
lambda
self
,
num_parts
:
partition
(
self
,
num_parts
)
SparseTensor
.
partition
=
lambda
self
,
num_parts
,
recursive
=
False
:
partition
(
self
,
num_parts
,
recursive
)
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