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
7c891506
Commit
7c891506
authored
Apr 12, 2020
by
bwdeng20
Browse files
test metis; ignore pycharm .idea/
parent
363c29ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
test/test_metis.py
test/test_metis.py
+8
-3
No files found.
test/test_metis.py
View file @
7c891506
...
@@ -7,11 +7,16 @@ from .utils import devices
...
@@ -7,11 +7,16 @@ 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
))
weighted_
mat
=
SparseTensor
.
from_dense
(
torch
.
randn
((
6
,
6
),
device
=
device
))
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
False
)
mat
,
partptr
,
perm
=
weighted_
mat
.
partition
(
num_parts
=
2
,
recursive
=
False
)
assert
partptr
.
numel
()
==
3
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
assert
perm
.
numel
()
==
6
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
mat
,
partptr
,
perm
=
weighted_mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
unweighted_mat
=
SparseTensor
.
from_dense
(
torch
.
ones
((
6
,
6
),
device
=
device
))
mat
,
partptr
,
perm
=
unweighted_mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
assert
partptr
.
numel
()
==
3
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
assert
perm
.
numel
()
==
6
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